Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-40687

Empty geometry field breaks mariadb-dump

    XMLWordPrintable

Details

    Description

      ALTER allows to add an empty geometry field to a table. mariadb-dump converts it into INSERT with an empty string, and upon an attempt to restore it it causes ER_CANT_CREATE_GEOMETRY_OBJECT (Cannot get geometry object from data you send to the GEOMETRY field).

      CREATE TABLE t (a INT);
      INSERT INTO t VALUES (1);
      ALTER TABLE t ADD COLUMN g GEOMETRY NOT NULL;
      SHOW CREATE TABLE t;
      SELECT a, HEX(g), LENGTH(g) FROM t;
      --exec $MYSQL_DUMP test --tables t > $MYSQL_TMP_DIR/t.dump
      DROP TABLE t;
      --exec $MYSQL test < $MYSQL_TMP_DIR/t.dump
       
      SELECT a, HEX(g), LENGTH(g) FROM t;
      DROP TABLE t;
      

      10.11 46ee2066f06e45b3cb701feb35a8816b27ac31b8

      Table   Create Table
      t       CREATE TABLE `t` (
        `a` int(11) DEFAULT NULL,
        `g` geometry NOT NULL
      ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
      SELECT a, HEX(g), LENGTH(g) FROM t;
      a       HEX(g)  LENGTH(g)
      1               0
      DROP TABLE t;
      bug.t                                    [ fail ]
              Test ended at 2026-08-10 13:21:50
       
      CURRENT_TEST: bug.t
      --------------
      INSERT INTO `t` VALUES
      (1,'')
      --------------
      ERROR 1416 (22003) at line 38: Cannot get geometry object from data you send to the GEOMETRY field
      mysqltest: At line 8: exec of '/10.11/mysql-test/var/my.cnf test < /10.11/mysql-test/var/tmp/t.dump' failed, error: 256, status: 1, errno: 11
      

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.