[MDEV-5481] mysqldump fails to dump geometry types properly Created: 2013-12-22  Updated: 2014-02-18  Due: 2014-01-31  Resolved: 2014-02-18

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.33a
Fix Version/s: 5.5.36

Type: Bug Priority: Major
Reporter: Guillaume Giraudon Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: geometry, mysqldump
Environment:

Debian Linux (Wheezy)



 Description   

When backing up a database with MYSQL_TYPE_GEOMETRY fields, mysqldump will output those fields in binary format by default. This causes issues upon restore.

The typical error returned by mysql when restoring such a dump is :

"Cannot get GEOMETRY object from the data you send to the Geometry field".

Using the --hex-blob option fails to treat GEOMETRY types as blobs.

A simple solution is to change the following line in mysqldump.c

field->type == MYSQL_TYPE_TINY_BLOB)) ? 1 : 0;

for
field->type == MYSQL_TYPE_TINY_BLOB ||
field->type == MYSQL_TYPE_GEOMETRY)) ? 1 : 0;



 Comments   
Comment by Elena Stepanova [ 2013-12-31 ]

Hi,

Could you please provide an example of the data which triggers the error? It would be useful for testing.
I tried some primitive values and didn't get into any trouble, so apparently it does not happen always.

Comment by Guillaume Giraudon [ 2013-12-31 ]

Hi Elena,

I'm having a hard time locating an exact instance of a data dump with failing details.
I will try to generate one from some past records we've had issues with.
Regardless of that, the problem with dumping data as binary in an SQL file is also one of charsets and carriage return interpretation.
This is of particular importance or interest when working accross platforms and trying to extract or manipulate SQL statements from a dump accross MariaDB installations of deployments.
mysqldump should have the ability to dump all records in non-binary format regardless of type in order to avoid corruption of data when moving charsets around.
Geometry objects being the only other record type to store binary information appart from Blobs, I propose it should either be considered as a Blob as well or alternatively have a switch like "--hex-geometry" to allow for non-binary dumping.

Best regards,

Guillaume

Comment by Alexey Botchkov [ 2014-02-18 ]

Fix:
http://lists.askmonty.org/pipermail/commits/2014-February/005920.html

Comment by Alexey Botchkov [ 2014-02-18 ]

pushed into 5.3

Generated at Thu Feb 08 07:04:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.