1--source include/have_rocksdb.inc
2
3--disable_warnings
4DROP TABLE IF EXISTS t1, t2;
5--enable_warnings
6
7CREATE TABLE t1 (b INT PRIMARY KEY);
8
9# Try simple foreign key - should fail
10--error ER_NOT_SUPPORTED_YET
11CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL, FOREIGN KEY (b) REFERENCES t1(b));
12
13# Try simple valid syntax with 'foreign' as part - should succeed
14CREATE TABLE t2 (a INT NOT NULL, bforeign INT NOT NULL);
15DROP TABLE t2;
16
17# Try simple valid syntax with 'foreign' and 'key' as part (with no space) - should succeed
18CREATE TABLE t2 (a INT NOT NULL, foreignkey INT NOT NULL);
19DROP TABLE t2;
20
21# Try with valid id containing 'foreign' and then a foreign key - should fail
22--error ER_NOT_SUPPORTED_YET
23CREATE TABLE t2 (a INT NOT NULL, bforeign INT not null, FOREIGN KEY (bforeign) REFERENCES t1(b));
24
25CREATE TABLE t2 (a INT NOT NULL, b INT NOT NULL);
26# Alter with foreign key - should fail
27--error ER_NOT_SUPPORTED_YET
28ALTER TABLE t2 ADD FOREIGN KEY (b) REFERENCES t1(b);
29DROP TABLE t2;
30
31# Alter with valid syntax that contains 'foreign' - should succeed
32CREATE TABLE t2 (a INT NOT NULL);
33ALTER TABLE t2 ADD bforeign INT NOT NULL;
34DROP TABLE t2;
35
36# Alter with valid syntax that contains 'foreign' and 'key' (no space) - should succeed
37CREATE TABLE t2 (a INT NOT NULL);
38ALTER TABLE t2 ADD foreignkey INT NOT NULL;
39DROP TABLE t2;
40
41# Alter with valid syntax that contains 'foreign' and then foreign key - should fail
42CREATE TABLE t2 (a INT NOT NULL);
43--error ER_NOT_SUPPORTED_YET
44ALTER TABLE t2 ADD bforeign INT NOT NULL, ADD FOREIGN KEY (bforeign) REFERENCES t1(b);
45DROP TABLE t2;
46
47DROP TABLE t1;
48