Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can mysqldump –hex-blob also dump DEFAULT values as hex?

We do database dumps of Shopware 6 databases. The system stores UUIDs in binary(16) fields.

Now when dumping databases with the --hex-blob option, the data columns are written properly as hex (0x12345….) but we saw that default values are still binary data (see cms_page_version_id)

CREATE TABLE `category` (
  `id` binary(16) NOT NULL,
  `version_id` binary(16) NOT NULL,
  `auto_increment` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` binary(16) DEFAULT NULL,
  `parent_version_id` binary(16) DEFAULT NULL,
  `media_id` binary(16) DEFAULT NULL,
  `cms_page_id` binary(16) DEFAULT NULL,
  `cms_page_version_id` binary(16) NOT NULL DEFAULT '^O©^\ãéjK¾KÙÎu,4%',
  `product_stream_id` binary(16) DEFAULT NULL,

We use this version:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

$ mysqldump --version
mysqldump  Ver 10.19 Distrib 10.3.31-MariaDB, for debian-linux-gnu (x86_64)

Is there an option of mysqldump to export also defaults as hex?

If we edit the dumps and save it with vi, the binary data is scrambled.

>Solution :

There is no such option to mysqldump. The --hex-blob option only applies to data values.

Mysqldump gets the CREATE TABLE statement using SHOW CREATE TABLE, which in turn relies on the INFORMATION_SCHEMA.

A bug was reported in 2013 that there’s effectively no way to get column DEFAULT values from this method if the value is binary and contains non-printable characters. https://bugs.mysql.com/bug.php?id=71172

The bug report was acknowledged, but so far it has not been fixed. Feel free to upvote the bug using the "Affects Me" button.

Or try to get MariaDB to fix it themselves, instead of the upstream MySQL code.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading