How to insert an mpoly in Mysql using WKB data

151 Views Asked by At

I'm trying to insert a mpoly WKB data into MySQL, which I get from a PostgreSQL dump. My table looks like this:

CREATE TABLE `region` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `is_active` tinyint(1) NOT NULL,
  `sort_order` int(11) DEFAULT NULL,
  `mpoly` multipolygon NOT NULL,
  PRIMARY KEY (`id`),
  KEY `region_4264c638` (`is_active`),
  KEY `region_a73f1f77` (`sort_order`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Now I'd like to add a new row:

INSERT INTO `region` (`id`, `is_active`, `sort_order`, `mpoly`) 
VALUES (150, true, 1, 
     MPolyFromWKB(
         '0106000020E610000001000000010300000001000000720B0000F722...'));

(The poly data is truncated, it's a rather long string in reality).

Which fails with Column 'mpoly' cannot be null. What am I doing wrong here and how can I debug it?

0

There are 0 best solutions below