[MySQL] Error with null bytes in binary field default values
Database management in a single PHP file
Brought to you by:
jakubvrana
Adminer (4.2.5) wth MySQL 5.6 doesn't play nicely with binary format fields with null-byte default values - for example if I add a binary field with a default value of '0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', it converts it to '0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', which is invalid, and throws an error.
Thanks sourceforge for messing up my formatting...
That second value should be:
'0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0'
(hopefully this will work - there should be a double-slash before each 0!)
Adminer uses hex format for binary fields. Try inserting it as 00000000000000000000000000000000. Also, it seems like you are missing one
\\
at the beginning.That's a kind of half-solution. It's still misformatting values in that context if you use normal MySQL syntax which I think should work. Notice that it doesn't attempt to use unhex on an alter table, so this is inconsistent. It works ok when running a manual query. The missing slashes previously was just sourceforge making a mess, not what I used.
I've attached some screen shots.
It should be consistent.
Adminer now displays default values as is in table structure and converts them to hex when inserting a new column.