Commit 8bb893f5 authored by Jimmy Yang's avatar Jimmy Yang

Fix Bug #13083023 - 60229: BROKEN COMPATIBILITY: ERROR WHILE CREATE TABLE

WITH FOREIGN KEY CONSTRAI

rb://844 approved by marko
parent 358a31df
CREATE TABLE PERSON (
PERSON_ID VARCHAR(50) NOT NULL,
DOB VARCHAR(50) NOT NULL,
NAME NVARCHAR(255) NOT NULL,
CONSTRAINT PK_PERSON PRIMARY KEY (PERSON_ID, DOB)
)Engine=InnoDB;
CREATE TABLE PHOTO (
PERSON_ID VARCHAR(50) NOT NULL,
DOB VARCHAR(50) NOT NULL,
PHOTO_DETAILS VARCHAR(50) NULL,
CONSTRAINT PK_PHOTO PRIMARY KEY (PERSON_ID, DOB),
CONSTRAINT FK_PHOTO_2_PERSON FOREIGN KEY (PERSON_ID, DOB) REFERENCES PERSON (PERSON_ID, DOB)
)Engine=InnoDB;
CREATE TABLE ADDRESS (
PERSON_ID VARCHAR(50) NOT NULL,
DOB VARCHAR(50) NOT NULL,
ADDRESS_ID VARCHAR(50) NOT NULL,
ADDRESS_DETAILS NVARCHAR(250) NULL,
CONSTRAINT PK_ADDRESS PRIMARY KEY (PERSON_ID, DOB, ADDRESS_ID),
CONSTRAINT FK_ADDRESS_2_PERSON FOREIGN KEY (PERSON_ID, DOB) REFERENCES PERSON (PERSON_ID, DOB) ON DELETE CASCADE
)Engine=InnoDB;
INSERT INTO PERSON VALUES("10", "11011999", "John");
INSERT INTO PHOTO VALUES("10", "11011999", "new photo");
DROP TABLE PHOTO;
DROP TABLE ADDRESS;
DROP TABLE PERSON;
#
# Bug #13083023 - 60229: BROKEN COMPATIBILITY: ERROR WHILE CREATE TABLE
# WITH FOREIGN KEY CONSTRAINT.
-- source include/have_innodb.inc
CREATE TABLE PERSON (
PERSON_ID VARCHAR(50) NOT NULL,
DOB VARCHAR(50) NOT NULL,
NAME NVARCHAR(255) NOT NULL,
CONSTRAINT PK_PERSON PRIMARY KEY (PERSON_ID, DOB)
)Engine=InnoDB;
CREATE TABLE PHOTO (
PERSON_ID VARCHAR(50) NOT NULL,
DOB VARCHAR(50) NOT NULL,
PHOTO_DETAILS VARCHAR(50) NULL,
CONSTRAINT PK_PHOTO PRIMARY KEY (PERSON_ID, DOB),
CONSTRAINT FK_PHOTO_2_PERSON FOREIGN KEY (PERSON_ID, DOB) REFERENCES PERSON (PERSON_ID, DOB)
)Engine=InnoDB;
CREATE TABLE ADDRESS (
PERSON_ID VARCHAR(50) NOT NULL,
DOB VARCHAR(50) NOT NULL,
ADDRESS_ID VARCHAR(50) NOT NULL,
ADDRESS_DETAILS NVARCHAR(250) NULL,
CONSTRAINT PK_ADDRESS PRIMARY KEY (PERSON_ID, DOB, ADDRESS_ID),
CONSTRAINT FK_ADDRESS_2_PERSON FOREIGN KEY (PERSON_ID, DOB) REFERENCES PERSON (PERSON_ID, DOB) ON DELETE CASCADE
)Engine=InnoDB;
INSERT INTO PERSON VALUES("10", "11011999", "John");
INSERT INTO PHOTO VALUES("10", "11011999", "new photo");
DROP TABLE PHOTO;
DROP TABLE ADDRESS;
DROP TABLE PERSON;
...@@ -3069,10 +3069,15 @@ dict_scan_table_name( ...@@ -3069,10 +3069,15 @@ dict_scan_table_name(
memcpy(ref, database_name, database_name_len); memcpy(ref, database_name, database_name_len);
ref[database_name_len] = '/'; ref[database_name_len] = '/';
memcpy(ref + database_name_len + 1, table_name, table_name_len + 1); memcpy(ref + database_name_len + 1, table_name, table_name_len + 1);
} else { } else {
#ifndef __WIN__
if (innobase_get_lower_case_table_names() == 1) { if (innobase_get_lower_case_table_names() == 1) {
innobase_casedn_str(ref); innobase_casedn_str(ref);
} }
#else
innobase_casedn_str(ref);
#endif /* !__WIN__ */
*table = dict_table_get_low(ref); *table = dict_table_get_low(ref);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment