Debian Codegraph @

mysql-test/suite/ndb/r/ndb_replace.result

raw
1 drop table if exists t1,t2;
2 CREATE TABLE t1 (
3 gesuchnr int(11) DEFAULT '0' NOT NULL,
4 benutzer_id int(11) DEFAULT '0' NOT NULL,
5 PRIMARY KEY (gesuchnr,benutzer_id)
6 ) engine=ndbcluster;
7 Warnings:
8 Warning 1681 Integer display width is deprecated and will be removed in a future release.
9 Warning 1681 Integer display width is deprecated and will be removed in a future release.
10 replace into t1 (gesuchnr,benutzer_id) values (2,1);
11 replace into t1 (gesuchnr,benutzer_id) values (1,1);
12 replace into t1 (gesuchnr,benutzer_id) values (1,1);
13 insert into t1 (gesuchnr, benutzer_id) value (3,2);
14 replace into t1 (gesuchnr,benutzer_id) values (1,1);
15 replace into t1 (gesuchnr,benutzer_id) values (1,1);
16 insert into t1 (gesuchnr,benutzer_id) values (1,1);
17 ERROR 23000: Duplicate entry '1-1' for key 't1.PRIMARY'
18 replace into t1 (gesuchnr,benutzer_id) values (1,1);
19 select * from t1 order by gesuchnr;
20 gesuchnr benutzer_id
21 1 1
22 2 1
23 3 2
24 drop table t1;
25 CREATE TABLE t1(i INT PRIMARY KEY AUTO_INCREMENT,
26 j INT,
27 k INT,
28 UNIQUE INDEX(j)
29 ) ENGINE = ndb;
30 INSERT INTO t1 VALUES (1,1,23),(2,2,24);
31 REPLACE INTO t1 (j,k) VALUES (1,42);
32 REPLACE INTO t1 (i,j) VALUES (17,2);
33 SELECT * from t1 ORDER BY i;
34 i j k
35 3 1 42
36 17 2 NULL
37 DROP TABLE t1;
38 CREATE TABLE t2 (a INT(11) NOT NULL,
39 b INT(11) NOT NULL,
40 c INT(11) NOT NULL,
41 x TEXT,
42 y TEXT,
43 z TEXT,
44 id INT(10) unsigned NOT NULL AUTO_INCREMENT,
45 i INT(11) DEFAULT NULL,
46 PRIMARY KEY (id),
47 UNIQUE KEY a (a,b,c)
48 ) ENGINE=ndbcluster;
49 Warnings:
50 Warning 1681 Integer display width is deprecated and will be removed in a future release.
51 Warning 1681 Integer display width is deprecated and will be removed in a future release.
52 Warning 1681 Integer display width is deprecated and will be removed in a future release.
53 Warning 1681 Integer display width is deprecated and will be removed in a future release.
54 Warning 1681 Integer display width is deprecated and will be removed in a future release.
55 REPLACE INTO t2 (a,b,c,x,y,z,i) VALUES (1,1,1,'a','a','a',1),(1,1,1,'b','b','b',2), (1,1,1,'c','c','c',3);
56 SELECT * FROM t2 ORDER BY id;
57 a b c x y z id i
58 1 1 1 c c c 3 3
59 REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'a','a','a',1);
60 REPLACE INTO t2(a,b,c,x,y,z,i) values (1,1,1,'b','b','b',2);
61 SELECT * FROM t2 ORDER BY id;
62 a b c x y z id i
63 1 1 1 b b b 5 2
64 DROP TABLE t2;
65 drop table if exists t1;
66 create table t1 (pk int primary key, apk int unique, data int) engine=ndbcluster;
67 insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
68 replace into t1 (pk, apk) values (4, 1), (5, 2);
69 select * from t1 order by pk;
70 pk apk data
71 3 3 3
72 4 1 NULL
73 5 2 NULL
74 delete from t1;
75 insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
76 replace into t1 (pk, apk) values (1, 4), (2, 5);
77 select * from t1 order by pk;
78 pk apk data
79 1 4 NULL
80 2 5 NULL
81 3 3 3
82 delete from t1;
83 insert into t1 values (1, 1, 1), (4, 4, 4), (6, 6, 6);
84 load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
85 select * from t1 order by pk;
86 pk apk data
87 1 1 1
88 3 4 NULL
89 5 6 NULL
90 delete from t1;
91 insert into t1 values (1, 1, 1), (3, 3, 3), (5, 5, 5);
92 load data infile '../../../std_data/loaddata5.dat' replace into table t1 fields terminated by '' enclosed by '' ignore 1 lines (pk, apk);
93 select * from t1 order by pk;
94 pk apk data
95 1 1 1
96 3 4 NULL
97 5 6 NULL
98 delete from t1;
99 insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3);
100 replace into t1 (pk, apk) select 4, 1;
101 replace into t1 (pk, apk) select 2, 4;
102 select * from t1 order by pk;
103 pk apk data
104 2 4 NULL
105 3 3 3
106 4 1 NULL
107 drop table t1;
108 End of 5.0 tests.
109 Warnings:
110 Warning 3135 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
111 CREATE TABLE t1(c1 INT NOT NULL PRIMARY KEY,
112 c2 INT NOT NULL DEFAULT 3,
113 c3 INT NULL DEFAULT 7,
114 c4 INT NOT NULL
115 ) ENGINE = NDB;
116 REPLACE INTO t1 (c1) VALUES (5);
117 Warnings:
118 Warning 1364 Field 'c4' doesn't have a default value
119 SELECT * FROM t1;
120 c1 c2 c3 c4
121 5 3 7 0
122 DELETE FROM t1;
123 INSERT INTO t1 (c1) VALUES (5);
124 Warnings:
125 Warning 1364 Field 'c4' doesn't have a default value
126 SELECT * FROM t1;
127 c1 c2 c3 c4
128 5 3 7 0
129 DROP TABLE t1;
130 CREATE TABLE t1(c1 INT NOT NULL,
131 c2 INT NOT NULL DEFAULT 3,
132 c3 INT NULL DEFAULT 7,
133 c4 INT NOT NULL
134 ) ENGINE = NDB;
135 REPLACE INTO t1 (c1) VALUES (5);
136 Warnings:
137 Warning 1364 Field 'c4' doesn't have a default value
138 SELECT * FROM t1;
139 c1 c2 c3 c4
140 5 3 7 0
141 DELETE FROM t1;
142 INSERT INTO t1 (c1) VALUES (5);
143 Warnings:
144 Warning 1364 Field 'c4' doesn't have a default value
145 SELECT * FROM t1;
146 c1 c2 c3 c4
147 5 3 7 0
148 DROP TABLE t1;