-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is currently missing and leads to incorrect types to be returned for `LEAST` & `GREATEST` as comparison functions. There's a little mismatch here in behavior compared to MySQL which I argue is actually a bug in MySQL. In MySQL, a temporal type always has the binary collation: ``` mysql> select NOW(6), collation(NOW(6)); +----------------------------+-------------------+ | NOW(6) | collation(NOW(6)) | +----------------------------+-------------------+ | 2025-02-19 15:33:21.732301 | binary | +----------------------------+-------------------+ 1 row in set (0.00 sec) ``` On MySQL 8.4, this results in: ``` mysql> select GREATEST(NOW(6), NOW(6)), collation(GREATEST(NOW(6), NOW(6))); +----------------------------+-------------------------------------+ | GREATEST(NOW(6), NOW(6)) | collation(GREATEST(NOW(6), NOW(6))) | +----------------------------+-------------------------------------+ | 2025-02-19 15:35:00.921308 | latin1_swedish_ci | +----------------------------+-------------------------------------+ 1 row in set (0.00 sec) ``` But on MySQL 8.0, it returns: ``` mysql> select GREATEST(NOW(6), NOW(6)), collation(GREATEST(NOW(6), NOW(6))); +----------------------------+-------------------------------------+ | GREATEST(NOW(6), NOW(6)) | collation(GREATEST(NOW(6), NOW(6))) | +----------------------------+-------------------------------------+ | 2025-02-19 15:35:00.921308 | utf8mb4_0900_ai_ci | +----------------------------+-------------------------------------+ 1 row in set (0.00 sec) ``` Neither of these collations make sense, because it really should not change the collation and return `binary` still. That is what Vitess still does with the changes here (hence the addition to the test framework to allow skipping the collation check). I'll also report the issue upstream to make it behave correctly there as well. Signed-off-by: Dirkjan Bussink <[email protected]>
- Loading branch information
Showing
14 changed files
with
909 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.