[MDEV-10479] Hexadecimal literals on X' value ' form not working in numeric context, gives warning Created: 2016-08-01 Updated: 2016-09-05 Resolved: 2016-09-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Documentation |
| Affects Version/s: | 5.5, 10.0, 10.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Karl Levik | Assignee: | Ian Gilfillan |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
According to this page: https://mariadb.com/kb/en/mariadb/hexadecimal-literals/ The result from:
and:
should be equivalent of:
However, I get 0 for the two former queries and 10 for the latter:
(This is also inconsistent with the results for these queries in MySQL.) |
| Comments |
| Comment by Elena Stepanova [ 2016-08-04 ] | ||||||
|
Thanks for the report. MySQL (5.5, 5.6, 5.7) returns 10 for all variants. | ||||||
| Comment by Alexander Barkov [ 2016-08-05 ] | ||||||
|
The syntax X'hhhh' stands for the SQL Standard <binary string literal> and must always behave as a string in all contexts. The syntax 0xhhhh stands for MySQL/MariaDB extension for hex hybrids which behave as a string or as a number depending on context. This behavior difference is expected. Binary string literals were fixed under terms on this bug report:
| ||||||
| Comment by Alexander Barkov [ 2016-08-05 ] | ||||||
|
Ian, can you please make sure that the difference between binary strings and hex hybrids is properly documented and close the issue as "Not a bug"? Example:
0x31 is treated as a number 0x31, because it's used in a numeric context. Note, MySQL returns 49 in both columns, which is wrong. Thanks. | ||||||
| Comment by Ian Gilfillan [ 2016-09-05 ] | ||||||
|
Clarified in the documentation | ||||||
| Comment by Elena Stepanova [ 2016-09-05 ] | ||||||
|
Re--opening for a moment to modify 'Resolution' field – technically, it was a bug (documentation problem) which has been fixed now. |