MYSQL import: Cannot get geometry object from data you send to the GEOMETRY field

好久不见. 提交于 2019-12-03 17:36:42

问题


I have recently upgraded to MySQL 5.7 and was trying to run a replication from 5.6 master. However the replication fails with the following error:

Error 'Cannot get geometry object from data you send to the GEOMETRY field' on query.

Turns out it also happens when I try to import data from the mysqldump. Table structure is as follows:

 CREATE TABLE `locations` (
  `location_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `country_id` int(10) unsigned NOT NULL,
  `name` varchar(100) CHARACTER SET utf8 NOT NULL,
  `locations_type_id` int(11) unsigned NOT NULL,
  `parent_id` int(11) unsigned DEFAULT NULL,
  `importance` decimal(3,2) NOT NULL DEFAULT '1.00',
  `lat` decimal(10,7) DEFAULT NULL,
  `lng` decimal(10,7) DEFAULT NULL,
  `radius` decimal(6,3) DEFAULT NULL,
  `polygon` polygon DEFAULT NULL,
  PRIMARY KEY (`location_id`),
  KEY `name` (`name`,`locations_type_id`,`parent_id`,`lat`,`lng`),
  KEY `locations_type_id` (`locations_type_id`),
  KEY `name_2` (`name`(8)),
  KEY `country_id` (`country_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

It appears to me that the import is trying to insert some binary data into the polygon field but in fairness I have no idea how to make it work.

Any ideas?


回答1:


If you can re-run mysqldump, try to add --hex-blob option to have all binary data exported as hex dump.



来源:https://stackoverflow.com/questions/34311195/mysql-import-cannot-get-geometry-object-from-data-you-send-to-the-geometry-fiel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!