[MDEV-14060] InnoDB: Foreign key constraint to geometry type does not work Created: 2017-10-12  Updated: 2017-10-25  Resolved: 2017-10-23

Status: Closed
Project: MariaDB Server
Component/s: GIS, Storage Engine - InnoDB
Affects Version/s: 10.2
Fix Version/s: 10.2.11

Type: Bug Priority: Major
Reporter: Jan Lindström (Inactive) Assignee: Jan Lindström (Inactive)
Resolution: Fixed Votes: 0
Labels: None


 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/'



 Comments   
Comment by Jan Lindström (Inactive) [ 2017-10-23 ]

commit fd7f912ebeb5efc5e3c23a8ba7d8cc13f4610b35
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Mon Oct 23 12:09:07 2017 +0300

MDEV-14060 InnoDB: Foreign key constraint to geometry type does not work

Test intentionally tried incorrect cases.

Generated at Thu Feb 08 08:10:37 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.