summaryrefslogtreecommitdiffstats
path: root/mysql-test/suite/storage_engine/update_with_keys.result
blob: ed62c96a5e6a6d9cddeb026094eb26fdd2ea1205 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, INDEX(b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z');
UPDATE t1 SET a=100, b='f' WHERE b IN ('b','c');
UPDATE t1 SET b='m' WHERE b = 'f';
UPDATE t1 SET b='z' WHERE a < 2;
UPDATE t1 SET b='';
SELECT a,b FROM t1;
a	b
1	
100	
100	
4	
5	
6	
7	
8	
DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, UNIQUE INDEX(a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a');
UPDATE t1 SET a=a+200;
UPDATE t1 SET a=0 WHERE a > 250;
UPDATE t1 SET a=205 WHERE a=200;
ERROR 23000: Duplicate entry '205' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). 
# If you got a difference in error message, just add it to rdiff file
UPDATE t1 SET a=12345 ORDER BY a, b LIMIT 1;
SELECT a,b FROM t1;
a	b
12345	a
200	f
201	a
202	b
203	c
204	d
205	e
UPDATE t1 SET a=80 WHERE a IN (202,203);
ERROR 23000: Duplicate entry '80' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). 
# If you got a difference in error message, just add it to rdiff file
DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, UNIQUE INDEX(a,b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'a'),(6,'f');
UPDATE t1 SET a=6 WHERE a=3;
UPDATE t1 SET a=100 WHERE a=1;
ERROR 23000: Duplicate entry '100-a' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). 
# If you got a difference in error message, just add it to rdiff file
UPDATE t1 SET a=4, b='d' WHERE b='f';
ERROR 23000: Duplicate entry '4-d' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). 
# If you got a difference in error message, just add it to rdiff file
UPDATE t1 SET a=a+1;
SELECT a,b FROM t1;
a	b
101	a
2	a
3	b
5	d
6	e
7	c
7	f
UPDATE t1 SET b='z';
ERROR 23000: Duplicate entry '7-z' for key 'a'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). 
# If you got a difference in error message, just add it to rdiff file
DROP TABLE t1;
CREATE TABLE t1 (a <INT_COLUMN> PRIMARY KEY, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a');
UPDATE t1 SET a=a+200;
UPDATE t1 SET a=0 WHERE a > 250;
UPDATE t1 SET a=205 WHERE a=200;
ERROR 23000: Duplicate entry '205' for key 'PRIMARY'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). 
# If you got a difference in error message, just add it to rdiff file
UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1;
SELECT a,b FROM t1;
a	b
0	a
12345	e
200	f
201	a
202	b
203	c
204	d
UPDATE t1 SET a=80 WHERE a IN (202,203);
ERROR 23000: Duplicate entry '80' for key 'PRIMARY'
# Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY). 
# If you got a difference in error message, just add it to rdiff file
DROP TABLE t1;