Return the correct collation for temporal results #602
+18
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When functions like
GREATEST
,LEAST
andCOALESCE
return a temporal result, the collation is not set tobinary
as expected.The collation for temporal types normally is always
binary
which is the case for fields and for functions inheriting fromItem_temporal_func
.The comparison functions mentioned here though don't inherit from that and can return various types. Internally they do set the numeric collation correctly, but at the protocol level (and for what the
COLLATION
function returns), it is translated to the binary collation.This translation does not happen before this change for the given functions, so we add it here.
Before:
After:
This issue applies to all supported MySQL versions, starting from 8.0.x and later at least.