File: innodb_bug60229.test

package info (click to toggle)
mysql-5.5 5.5.42-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 201,212 kB
  • sloc: cpp: 646,036; ansic: 551,342; perl: 53,243; pascal: 25,099; yacc: 13,059; sh: 10,248; cs: 4,647; xml: 4,178; sql: 3,193; makefile: 1,368; lex: 639; awk: 54
file content (39 lines) | stat: -rw-r--r-- 1,133 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#
# 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;