~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysql-test/r/foreign_key.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,
2
 
price DECIMAL,
3
 
PRIMARY KEY(category, id)) ENGINE=INNODB;
4
 
CREATE TABLE customer (id INT NOT NULL,
5
 
PRIMARY KEY (id)) ENGINE=INNODB;
6
 
CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,
7
 
product_category INT NOT NULL,
8
 
product_id INT NOT NULL,
9
 
customer_id INT NOT NULL,
10
 
PRIMARY KEY(no),
11
 
INDEX (product_category, product_id),
12
 
FOREIGN KEY (product_category, product_id)
13
 
REFERENCES product(category, id)
14
 
ON UPDATE CASCADE ON DELETE RESTRICT,
15
 
INDEX (customer_id),
16
 
FOREIGN KEY (customer_id)
17
 
REFERENCES customer(id)) ENGINE=INNODB;
18
 
show create table product_order;
19
 
Table   Create Table
20
 
product_order   CREATE TABLE `product_order` (
21
 
  `no` INT NOT NULL AUTO_INCREMENT,
22
 
  `product_category` INT NOT NULL,
23
 
  `product_id` INT NOT NULL,
24
 
  `customer_id` INT NOT NULL,
25
 
  PRIMARY KEY (`no`),
26
 
  KEY `product_category` (`product_category`,`product_id`),
27
 
  KEY `customer_id` (`customer_id`),
28
 
  CONSTRAINT `product_order_ibfk_1` FOREIGN KEY (`product_category`, `product_id`) REFERENCES `product` (`category`, `id`) ON UPDATE CASCADE ON DELETE RESTRICT,
29
 
  CONSTRAINT `product_order_ibfk_2` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`id`)
30
 
) ENGINE=InnoDB COLLATE = utf8_general_ci
31
 
drop table product_order, customer, product;
 
1
drop table if exists t1;
 
2
create table t1 (
 
3
a int not null references t2,
 
4
b int not null references t2 (c),
 
5
primary key (a,b),
 
6
foreign key (a) references t3 match full,
 
7
foreign key (a) references t3 match partial,
 
8
foreign key (a,b) references t3 (c,d) on delete no action
 
9
on update no action,
 
10
foreign key (a,b) references t3 (c,d) on update cascade,
 
11
foreign key (a,b) references t3 (c,d) on delete set default,
 
12
foreign key (a,b) references t3 (c,d) on update set null);
 
13
create index a on t1 (a);
 
14
create unique index b on t1 (a,b);
 
15
drop table t1;
32
16
drop table if exists t_34455;
33
17
create table t_34455 (
34
18
a int not null,
35
19
foreign key (a) references t3 (a) match full match partial);
36
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'match partial)' at line 3
 
20
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match partial)' at line 3
37
21
create table t_34455 (
38
22
a int not null,
39
23
foreign key (a) references t3 (a) on delete set default match full);
40
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'match full)' at line 3
 
24
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 3
41
25
create table t_34455 (
42
26
a int not null,
43
27
foreign key (a) references t3 (a) on update set default match full);
44
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'match full)' at line 3
 
28
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 3
45
29
create table t_34455 (
46
30
a int not null,
47
31
foreign key (a) references t3 (a)
48
32
on delete set default on delete set default);
49
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'delete set default)' at line 4
 
33
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete set default)' at line 4
50
34
create table t_34455 (
51
35
a int not null,
52
36
foreign key (a) references t3 (a)
53
37
on update set default on update set default);
54
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'update set default)' at line 4
 
38
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update set default)' at line 4
55
39
create table t_34455 (a int not null);
56
40
alter table t_34455
57
41
add foreign key (a) references t3 (a) match full match partial);
58
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'match partial)' at line 1
 
42
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match partial)' at line 2
59
43
alter table t_34455
60
44
add foreign key (a) references t3 (a) on delete set default match full);
61
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'match full)' at line 1
 
45
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 2
62
46
alter table t_34455
63
47
add foreign key (a) references t3 (a) on update set default match full);
64
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'match full)' at line 1
 
48
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'match full)' at line 2
65
49
alter table t_34455
66
50
add foreign key (a) references t3 (a)
67
51
on delete set default on delete set default);
68
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'delete set default)' at line 2
 
52
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete set default)' at line 3
69
53
alter table t_34455
70
54
add foreign key (a) references t3 (a)
71
55
on update set default on update set default);
72
 
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'update set default)' at line 2
 
56
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update set default)' at line 3
73
57
drop table t_34455;