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

InnoDB: Foreign key constraint to geometry type does not work

    XMLWordPrintable

    Details

      Description

      innodb_gis.point_basic 'innodb'          [ fail ]
              Test ended at 2017-10-12 17:18:34
       
      CURRENT_TEST: innodb_gis.point_basic
      mysqltest: At line 781: query 'ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p)' failed with wrong errno 1005: 'Can't create table `test`.`#sql-76c2_9` (errno: 150 "Foreign key constraint is incorrectly formed")', instead of 1215...
       
      The result from queries just before the failure was:
      < snip >
      parent	CREATE TABLE `parent` (
        `p` point NOT NULL,
        PRIMARY KEY (`p`(25)),
        SPATIAL KEY `idx1` (`p`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      SHOW CREATE TABLE child;
      Table	Create Table
      child	CREATE TABLE `child` (
        `p` point NOT NULL,
        SPATIAL KEY `idx2` (`p`)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
      ERROR HY000: Can't create table `test`.`#sql-76c2_9` (errno: 150 "Foreign key constraint is incorrectly formed")
      show warnings;
      Level	Code	Message
      Warning	150	Alter  table '`test`.`child`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
      Error	1005	Can't create table `test`.`#sql-76c2_9` (errno: 150 "Foreign key constraint is incorrectly formed")
      Warning	1215	Cannot add foreign key constraint
      ALTER TABLE parent DROP INDEX idx1;
      ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
       
      More results from queries before failure can be found in /dev/shm/log/point_basic.log
       
       - saving '/dev/shm/log/innodb_gis.point_basic-innodb/' to '/dev/shm/log/innodb_gis.point_basic-innodb/'
      

        Attachments

          Activity

            People

            Assignee:
            jplindst Jan Lindström
            Reporter:
            jplindst Jan Lindström
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: