Debian Codegraph @

mysql-test/suite/storage_engine/replace.result

raw
1 DROP TABLE IF EXISTS t1;
2 CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
3 REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e');
4 SELECT a,b FROM t1;
5 a b
6 1 a
7 2 b
8 3 c
9 4 d
10 5 e
11 REPLACE t1 (a,b) VALUE (10,'foo'),(10,'foo');
12 SELECT a,b FROM t1;
13 a b
14 1 a
15 10 foo
16 10 foo
17 2 b
18 3 c
19 4 d
20 5 e
21 DROP TABLE t1;
22 CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, UNIQUE INDEX (a)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
23 REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
24 INSERT INTO t1 (a,b) VALUES (2,'d');
25 ERROR 23000: Duplicate entry '2' for key 'a'
26 # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
27 # If you got a difference in error message, just add it to rdiff file
28 REPLACE INTO t1 (a,b) VALUES (2,'d');
29 SELECT a,b FROM t1;
30 a b
31 1 a
32 2 d
33 3 c
34 DROP TABLE t1;
35 CREATE TABLE t1 (a <INT_COLUMN>, b <CHAR_COLUMN>, PRIMARY KEY (b)) ENGINE=<STORAGE_ENGINE> <CUSTOM_TABLE_OPTIONS>;
36 REPLACE INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c');
37 INSERT INTO t1 (a,b) VALUES (4,'b');
38 ERROR 23000: Duplicate entry 'b' for key 'PRIMARY'
39 # Statement ended with one of expected results (ER_DUP_ENTRY,ER_DUP_KEY).
40 # If you got a difference in error message, just add it to rdiff file
41 REPLACE INTO t1 (a,b) VALUES (4,'b');
42 SELECT a,b FROM t1;
43 a b
44 1 a
45 3 c
46 4 b
47 DROP TABLE t1;