Bug #78642 Documentation should favour x'' form for hexadecimal literals
Submitted: 30 Sep 2015 9:26 Modified: 13 Nov 2015 14:18
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[30 Sep 2015 9:26] Guilhem Bichot
Description:
https://dev.mysql.com/doc/refman/5.7/en/hexadecimal-literals.html
says:

"MySQL supports hexadecimal values, written using X'val', x'val', or 0xval format ... The X'hexstring' syntax is based on standard SQL. The 0x syntax is based on ODBC."

By the way x'' is SQL-standard too,  like X'' .

0x literals are mentioned in examples in the manual (in this page and maybe somewhere else), we would like them to be replaced with x'' or X''.

This is because 0x is used in languages (C++, Python) for integer constants, and this will make people think that it's also an integer constant in MySQL, whereas it is actually a binary string (as said in the page: "The default type of a hexadecimal value is a string").

We also suggest that the page insist on the literal *being* a binary string, which is only *cast* to integer in some cases.  Its current wording suggests that the literal is a polymorphic creature.

So the task is:
- researching for examples everywhere in the manual (grep for 0x ?) and make them use x'' or X''
- rephrasing the above page

How to repeat:
n/a
[30 Sep 2015 9:33] MySQL Verification Team
Hello Guilhem,

Thank you for the report.

Thanks,
Umesh
[30 Sep 2015 13:47] Guilhem Bichot
Correction to the above. It is not just a binary string ; it is a binary string with special casting properties when cast to integer.

+-------------------------+
| convert(x'32',unsigned) |
+-------------------------+
| 50 |
+-------------------------+
+--------------------------------------------+
| convert(convert(x'32',binary(1)),unsigned) |
+--------------------------------------------+
| 2 |
+--------------------------------------------+
[13 Nov 2015 14:18] Paul DuBois
Thank you for your bug report. This issue has been addressed in the documentation. The updated documentation will appear on our website shortly.