Bug #73858 | Can't use COLLATE | ||
---|---|---|---|
Submitted: | 9 Sep 2014 13:00 | Modified: | 6 Oct 2015 17:48 |
Reporter: | Peter Laursen (Basic Quality Contributor) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Charsets | Severity: | S3 (Non-critical) |
Version: | 5.6.12, 5.5.42, 5.6.23, 5.7.6 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[9 Sep 2014 13:00]
Peter Laursen
[15 Sep 2014 16:23]
Hartmut Holzgraefe
Syntax is ORDER BY ... COLLATE ... DESC not ORDER BY ... DESC COLLATE ... That explains the different error on the last statement, not the latin1/utf8 issue though ... SELECT txn_id FROM `order_details` ORDER BY `order_id` COLLATE utf8_bin DESC LIMIT 100; ERROR 1253 (42000): COLLATION 'utf8_bin' is not valid for CHARACTER SET 'latin1'
[15 Sep 2014 17:18]
Peter Laursen
Thanks to Hartmut. With hindsight it is logical, actually, that COLLATE must happen before SORT/ORDER BY.
[27 Jan 2015 21:11]
Sveta Smirnova
Thank you for the report. Verified as described. We should either allow to convert integer values to any character sets/table character sets or, at least, document these conversion rules for integers, converted to strings.
[6 Oct 2015 17:48]
Paul DuBois
Noted in 5.7.10, 5.8.0 changelogs. For constructs such as ORDER BY numeric_expr COLLATE collation_name, the character set of the expression was treated as latin1, which resulted in an error if the collation specified after COLLATE is incompatible with latin1. Now when a numeric expression is implicitly cast to a character expression in the presence of COLLATE, the character set used is the one associated with the named collation.