summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/innodb/r/innodb-on-duplicate-update.result
blob: 474ebf33bbda90d13ad0b08866959e6ebb089014 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
set sql_mode='';
set innodb_strict_mode=0;
CREATE TABLE `v` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INSERT v values (1);
CREATE TABLE `vp` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`v_id` int(10) unsigned NOT NULL,
`p_id` int(10) unsigned NOT NULL,
`ppp` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `IDX_vp_uniq` (`v_id`,`p_id`),
KEY `FK_vp_v` (`v_id`),
CONSTRAINT `FK_vp_v` FOREIGN KEY (`v_id`) REFERENCES `v` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INSERT vp VALUES (12, 1, 100, 'text12');
INSERT INTO `vp` (`id`,`ppp`) VALUES (12, 'test12-2') ON DUPLICATE KEY UPDATE `ppp` = VALUES(`ppp`);
Warnings:
Warning	1364	Field 'v_id' doesn't have a default value
Warning	1364	Field 'p_id' doesn't have a default value
SELECT * FROM vp;
id	v_id	p_id	ppp
12	1	100	test12-2
DROP TABLE vp, v;
CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB;
INSERT into t1 values (1);
CREATE TABLE t2 (
i int not null primary key,
vi int not null,
m int,
UNIQUE KEY (vi),
CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
INSERT into t2 VALUES (1, 1, 100);
INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3;
Warnings:
Warning	1364	Field 'vi' doesn't have a default value
SELECT * FROM t2;
i	vi	m
1	1	3
DROP TABLE t2,t1;
CREATE TABLE t1 (i int PRIMARY KEY) ENGINE=InnoDB;
INSERT into t1 values (1);
CREATE TABLE t2 (
i int not null primary key,
vi int not null,
m int,
KEY (vi),
CONSTRAINT `cc` FOREIGN KEY (vi) REFERENCES t1 (i) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB;
INSERT into t2 VALUES (1, 1, 100);
INSERT INTO t2 (i,m) VALUES (1, 2) ON DUPLICATE KEY UPDATE m=3;
Warnings:
Warning	1364	Field 'vi' doesn't have a default value
SELECT * FROM t2;
i	vi	m
1	1	3
DROP TABLE t2, t1;