Debian Codegraph @

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

raw
1 CREATE TABLE t1 (
2 pk1 INT NOT NULL PRIMARY KEY,
3 attr1 INT NOT NULL,
4 attr2 INT,
5 attr3 VARCHAR(10)
6 ) ENGINE=ndbcluster;
7 SHOW INDEX FROM t1;
8 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
9 t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE YES NULL
10 INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
11 SHOW INDEX FROM t1;
12 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment Visible Expression
13 t1 0 PRIMARY 1 pk1 A 0 NULL NULL BTREE YES NULL
14 SELECT pk1 FROM t1 ORDER BY pk1;
15 pk1
16 9410
17 9411
18 SELECT * FROM t1 ORDER BY pk1;
19 pk1 attr1 attr2 attr3
20 9410 9412 NULL 9412
21 9411 9413 17 9413
22 SELECT t1.* FROM t1 ORDER BY pk1;
23 pk1 attr1 attr2 attr3
24 9410 9412 NULL 9412
25 9411 9413 17 9413
26 UPDATE t1 SET attr1=1 WHERE pk1=9410;
27 SELECT * FROM t1 ORDER BY pk1;
28 pk1 attr1 attr2 attr3
29 9410 1 NULL 9412
30 9411 9413 17 9413
31 UPDATE t1 SET pk1=2 WHERE attr1=1;
32 SELECT * FROM t1 ORDER BY pk1;
33 pk1 attr1 attr2 attr3
34 2 1 NULL 9412
35 9411 9413 17 9413
36 UPDATE t1 SET pk1=pk1 + 1;
37 SELECT * FROM t1 ORDER BY pk1;
38 pk1 attr1 attr2 attr3
39 3 1 NULL 9412
40 9412 9413 17 9413
41 UPDATE t1 SET pk1=4 WHERE pk1 = 3;
42 SELECT * FROM t1 ORDER BY pk1;
43 pk1 attr1 attr2 attr3
44 4 1 NULL 9412
45 9412 9413 17 9413
46 DELETE FROM t1;
47 SELECT * FROM t1;
48 pk1 attr1 attr2 attr3
49 INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9408, 8765, NULL, '8765'),
50 (7,8, NULL, NULL), (8,9, NULL, NULL), (9,10, NULL, NULL), (10,11, NULL, NULL), (11,12, NULL, NULL), (12,13, NULL, NULL), (13,14, NULL, NULL);
51 UPDATE t1 SET attr1 = 9999;
52 SELECT * FROM t1 ORDER BY pk1;
53 pk1 attr1 attr2 attr3
54 7 9999 NULL NULL
55 8 9999 NULL NULL
56 9 9999 NULL NULL
57 10 9999 NULL NULL
58 11 9999 NULL NULL
59 12 9999 NULL NULL
60 13 9999 NULL NULL
61 9408 9999 NULL 8765
62 9410 9999 NULL 9412
63 UPDATE t1 SET attr1 = 9998 WHERE pk1 < 1000;
64 SELECT * FROM t1 ORDER BY pk1;
65 pk1 attr1 attr2 attr3
66 7 9998 NULL NULL
67 8 9998 NULL NULL
68 9 9998 NULL NULL
69 10 9998 NULL NULL
70 11 9998 NULL NULL
71 12 9998 NULL NULL
72 13 9998 NULL NULL
73 9408 9999 NULL 8765
74 9410 9999 NULL 9412
75 UPDATE t1 SET attr1 = 9997 WHERE attr1 = 9999;
76 SELECT * FROM t1 ORDER BY pk1;
77 pk1 attr1 attr2 attr3
78 7 9998 NULL NULL
79 8 9998 NULL NULL
80 9 9998 NULL NULL
81 10 9998 NULL NULL
82 11 9998 NULL NULL
83 12 9998 NULL NULL
84 13 9998 NULL NULL
85 9408 9997 NULL 8765
86 9410 9997 NULL 9412
87 DELETE FROM t1 WHERE pk1 = 9410;
88 SELECT * FROM t1 ORDER BY pk1;
89 pk1 attr1 attr2 attr3
90 7 9998 NULL NULL
91 8 9998 NULL NULL
92 9 9998 NULL NULL
93 10 9998 NULL NULL
94 11 9998 NULL NULL
95 12 9998 NULL NULL
96 13 9998 NULL NULL
97 9408 9997 NULL 8765
98 DELETE FROM t1;
99 SELECT * FROM t1;
100 pk1 attr1 attr2 attr3
101 INSERT INTO t1 values (1, 4, NULL, NULL), (2, 4, NULL, NULL), (3, 5, NULL, NULL), (4, 4, NULL, NULL), (5, 5, NULL, NULL);
102 DELETE FROM t1 WHERE attr1=4;
103 SELECT * FROM t1 order by pk1;
104 pk1 attr1 attr2 attr3
105 3 5 NULL NULL
106 5 5 NULL NULL
107 DELETE FROM t1;
108 INSERT INTO t1 VALUES (9410,9412, NULL, NULL), (9411, 9413, NULL, NULL);
109 DELETE FROM t1 WHERE pk1 = 9410;
110 SELECT * FROM t1;
111 pk1 attr1 attr2 attr3
112 9411 9413 NULL NULL
113 DROP TABLE t1;
114 CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
115 INSERT INTO t1 values(3456, 7890);
116 SELECT * FROM t1;
117 id id2
118 3456 7890
119 UPDATE t1 SET id=2 WHERE id2=12;
120 SELECT * FROM t1;
121 id id2
122 3456 7890
123 UPDATE t1 SET id=1234 WHERE id2=7890;
124 SELECT * FROM t1;
125 id id2
126 1234 7890
127 DELETE FROM t1;
128 INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
129 SELECT * FROM t1 ORDER BY id;
130 id id2
131 3454 7890
132 3456 7890
133 3456 7890
134 3456 7890
135 DELETE FROM t1 WHERE id = 3456;
136 SELECT * FROM t1 ORDER BY id;
137 id id2
138 3454 7890
139 DROP TABLE t1;
140 CREATE TABLE t1 (
141 pk1 INT NOT NULL PRIMARY KEY,
142 attr1 INT NOT NULL
143 ) ENGINE=NDBCLUSTER;
144 INSERT INTO t1 values(1, 9999);
145 DROP TABLE t1;
146 CREATE TABLE t1 (
147 pk1 INT NOT NULL PRIMARY KEY,
148 attr1 INT NOT NULL
149 ) ENGINE=NDB;
150 INSERT INTO t1 values(1, 9999);
151 DROP TABLE t1;
152 CREATE TABLE t2 (
153 a bigint unsigned NOT NULL PRIMARY KEY,
154 b int unsigned not null,
155 c int unsigned
156 ) engine=ndbcluster;
157 CREATE TABLE t3 (
158 a bigint unsigned NOT NULL,
159 b bigint unsigned not null,
160 c bigint unsigned,
161 PRIMARY KEY(a)
162 ) engine=ndbcluster;
163 CREATE TABLE t4 (
164 a bigint unsigned NOT NULL,
165 b bigint unsigned not null,
166 c bigint unsigned NOT NULL,
167 d int unsigned,
168 PRIMARY KEY(a, b, c)
169 ) engine=ndbcluster;
170 select * from t2 where a = 7 order by b;
171 a b c
172 7 16 5
173 select * from t2 where a = 7 order by a;
174 a b c
175 7 16 5
176 select * from t2 where a = 7 order by 2;
177 a b c
178 7 16 5
179 select * from t2 where a = 7 order by c;
180 a b c
181 7 16 5
182 select * from t2 where a = 7 and b = 16 order by b;
183 a b c
184 7 16 5
185 select * from t2 where a = 7 and b = 16 order by a;
186 a b c
187 7 16 5
188 select * from t2 where a = 7 and b = 17 order by a;
189 a b c
190 select * from t2 where a = 7 and b != 16 order by b;
191 a b c
192 select * from t2 where a = 7 and b = 16 and c = 5 order by b;
193 a b c
194 7 16 5
195 select * from t2 where a = 7 and b = 16 and c = 5 order by a;
196 a b c
197 7 16 5
198 select * from t2 where a = 7 and b = 16 and c = 6 order by a;
199 a b c
200 select * from t2 where a = 7 and b != 16 and c = 5 order by b;
201 a b c
202 select * from t3 where a = 7 order by b;
203 a b c
204 7 16 5
205 select * from t3 where a = 7 order by a;
206 a b c
207 7 16 5
208 select * from t3 where a = 7 order by 2;
209 a b c
210 7 16 5
211 select * from t3 where a = 7 order by c;
212 a b c
213 7 16 5
214 select * from t3 where a = 7 and b = 16 order by b;
215 a b c
216 7 16 5
217 select * from t3 where a = 7 and b = 16 order by a;
218 a b c
219 7 16 5
220 select * from t3 where a = 7 and b = 17 order by a;
221 a b c
222 select * from t3 where a = 7 and b != 16 order by b;
223 a b c
224 select * from t4 where a = 7 order by b;
225 a b c d
226 7 16 5 26007
227 select * from t4 where a = 7 order by a;
228 a b c d
229 7 16 5 26007
230 select * from t4 where a = 7 order by 2;
231 a b c d
232 7 16 5 26007
233 select * from t4 where a = 7 order by c;
234 a b c d
235 7 16 5 26007
236 select * from t4 where a = 7 and b = 16 order by b;
237 a b c d
238 7 16 5 26007
239 select * from t4 where a = 7 and b = 16 order by a;
240 a b c d
241 7 16 5 26007
242 select * from t4 where a = 7 and b = 17 order by a;
243 a b c d
244 select * from t4 where a = 7 and b != 16 order by b;
245 a b c d
246 delete from t2 where a > 5;
247 select x1.a, x1.b from t2 x1, t2 x2 where x1.b = x2.b order by x1.a;
248 a b
249 1 10
250 3 12
251 5 14
252 select a, b FROM t2 outer_table where
253 a = (select a from t2 where b = outer_table.b ) order by a;
254 a b
255 1 10
256 3 12
257 5 14
258 delete from t2;
259 delete from t3;
260 delete from t4;
261 drop table t2;
262 drop table t3;
263 drop table t4;
264 CREATE TABLE t5 (
265 a bigint unsigned NOT NULL,
266 b bigint unsigned not null,
267 c bigint unsigned NOT NULL,
268 d int unsigned,
269 PRIMARY KEY(a, b, c)
270 ) engine=ndbcluster;
271 insert into t5 values(10, 19, 5, 26010);
272 delete from t5 where a=10 and b=19 and c=5;
273 select * from t5;
274 a b c d
275 insert into t5 values(10, 19, 5, 26010);
276 update t5 set d=21997 where a=10 and b=19 and c=5;
277 select * from t5;
278 a b c d
279 10 19 5 21997
280 delete from t5;
281 drop table t5;
282 CREATE TABLE t6 (
283 adress char(255),
284 a int NOT NULL PRIMARY KEY,
285 b int
286 ) engine = NDB;
287 insert into t6 values
288 ("Nice road 3456", 1, 23),
289 ("Street Road 78", 3, 92),
290 ("Road street 89C", 5, 71),
291 (NULL, 7, NULL);
292 select * from t6 order by a;
293 adress a b
294 Nice road 3456 1 23
295 Street Road 78 3 92
296 Road street 89C 5 71
297 NULL 7 NULL
298 select a, b from t6 order by a;
299 a b
300 1 23
301 3 92
302 5 71
303 7 NULL
304 update t6 set adress="End of road 09" where a=3;
305 update t6 set b=181, adress="Street 76" where a=7;
306 select * from t6 order by a;
307 adress a b
308 Nice road 3456 1 23
309 End of road 09 3 92
310 Road street 89C 5 71
311 Street 76 7 181
312 select * from t6 where a=1;
313 adress a b
314 Nice road 3456 1 23
315 delete from t6 where a=1;
316 select * from t6 order by a;
317 adress a b
318 End of road 09 3 92
319 Road street 89C 5 71
320 Street 76 7 181
321 delete from t6 where b=71;
322 select * from t6 order by a;
323 adress a b
324 End of road 09 3 92
325 Street 76 7 181
326 drop table t6;
327 CREATE TABLE t7 (
328 adress char(255),
329 a int NOT NULL,
330 b int,
331 c int NOT NULL,
332 PRIMARY KEY(a, c)
333 ) engine = NDB;
334 insert into t7 values
335 ("Highway 3456", 1, 23, 2),
336 ("Street Road 78", 3, 92, 3),
337 ("Main street 89C", 5, 71, 4),
338 (NULL, 8, NULL, 12);
339 select * from t7 order by a;
340 adress a b c
341 Highway 3456 1 23 2
342 Street Road 78 3 92 3
343 Main street 89C 5 71 4
344 NULL 8 NULL 12
345 select a, b from t7 order by a;
346 a b
347 1 23
348 3 92
349 5 71
350 8 NULL
351 update t7 set adress="End of road 09" where a=3;
352 update t7 set adress="Gatuvägen 90C" where a=5 and c=4;
353 update t7 set adress="No adress" where adress is NULL;
354 select * from t7 order by a;
355 adress a b c
356 Highway 3456 1 23 2
357 End of road 09 3 92 3
358 Gatuvägen 90C 5 71 4
359 No adress 8 NULL 12
360 select * from t7 where a=1 and c=2;
361 adress a b c
362 Highway 3456 1 23 2
363 delete from t7 where a=1;
364 delete from t7 where a=3 and c=3;
365 delete from t7 where a=5 and c=4;
366 select * from t7;
367 adress a b c
368 No adress 8 NULL 12
369 delete from t7 where b=23;
370 select * from t7;
371 adress a b c
372 No adress 8 NULL 12
373 drop table t7;
374 CREATE TABLE t1 (
375 pk1 INT NOT NULL PRIMARY KEY,
376 attr1 INT NOT NULL,
377 attr2 INT,
378 attr3 VARCHAR(10)
379 ) ENGINE=ndbcluster;
380 INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
381 create database mysqltest;
382 use mysqltest;
383 CREATE TABLE t2 (
384 a bigint unsigned NOT NULL PRIMARY KEY,
385 b int unsigned not null,
386 c int unsigned
387 ) engine=ndbcluster;
388 insert into t2 select pk1,attr1,attr2 from test.t1;
389 select * from t2 order by a;
390 a b c
391 9410 9412 NULL
392 9411 9413 17
393 select b from test.t1, t2 where c = test.t1.attr2;
394 b
395 9413
396 select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
397 b attr1
398 9413 9412
399 drop table test.t1, t2;
400 drop database mysqltest;
401 drop database if exists ndbtest1;
402 create database ndbtest1;
403 use ndbtest1;
404 create table t1(id int) engine=ndbcluster;
405 drop database ndbtest1;
406 drop database ndbtest1;
407 ERROR HY000: Can't drop database 'ndbtest1'; database doesn't exist
408 use test;
409 create table t1 (a int primary key, b char(0));
410 insert into t1 values (1,"");
411 insert into t1 values (2,NULL);
412 select * from t1 order by a;
413 a b
414 1
415 2 NULL
416 select * from t1 order by b;
417 a b
418 2 NULL
419 1
420 select * from t1 where b IS NULL;
421 a b
422 2 NULL
423 select * from t1 where b IS NOT NULL;
424 a b
425 1
426 drop table t1;
427 create table t1 ( c511 int, c510 int, c509 int, c508 int, c507 int, c506 int, c505 int, c504 int, c503 int, c502 int, c501 int, c500 int, c499 int, c498 int, c497 int, c496 int, c495 int, c494 int, c493 int, c492 int, c491 int, c490 int, c489 int, c488 int, c487 int, c486 int, c485 int, c484 int, c483 int, c482 int, c481 int, c480 int, c479 int, c478 int, c477 int, c476 int, c475 int, c474 int, c473 int, c472 int, c471 int, c470 int, c469 int, c468 int, c467 int, c466 int, c465 int, c464 int, c463 int, c462 int, c461 int, c460 int, c459 int, c458 int, c457 int, c456 int, c455 int, c454 int, c453 int, c452 int, c451 int, c450 int, c449 int, c448 int, c447 int, c446 int, c445 int, c444 int, c443 int, c442 int, c441 int, c440 int, c439 int, c438 int, c437 int, c436 int, c435 int, c434 int, c433 int, c432 int, c431 int, c430 int, c429 int, c428 int, c427 int, c426 int, c425 int, c424 int, c423 int, c422 int, c421 int, c420 int, c419 int, c418 int, c417 int, c416 int, c415 int, c414 int, c413 int, c412 int, c411 int, c410 int, c409 int, c408 int, c407 int, c406 int, c405 int, c404 int, c403 int, c402 int, c401 int, c400 int, c399 int, c398 int, c397 int, c396 int, c395 int, c394 int, c393 int, c392 int, c391 int, c390 int, c389 int, c388 int, c387 int, c386 int, c385 int, c384 int, c383 int, c382 int, c381 int, c380 int, c379 int, c378 int, c377 int, c376 int, c375 int, c374 int, c373 int, c372 int, c371 int, c370 int, c369 int, c368 int, c367 int, c366 int, c365 int, c364 int, c363 int, c362 int, c361 int, c360 int, c359 int, c358 int, c357 int, c356 int, c355 int, c354 int, c353 int, c352 int, c351 int, c350 int, c349 int, c348 int, c347 int, c346 int, c345 int, c344 int, c343 int, c342 int, c341 int, c340 int, c339 int, c338 int, c337 int, c336 int, c335 int, c334 int, c333 int, c332 int, c331 int, c330 int, c329 int, c328 int, c327 int, c326 int, c325 int, c324 int, c323 int, c322 int, c321 int, c320 int, c319 int, c318 int, c317 int, c316 int, c315 int, c314 int, c313 int, c312 int, c311 int, c310 int, c309 int, c308 int, c307 int, c306 int, c305 int, c304 int, c303 int, c302 int, c301 int, c300 int, c299 int, c298 int, c297 int, c296 int, c295 int, c294 int, c293 int, c292 int, c291 int, c290 int, c289 int, c288 int, c287 int, c286 int, c285 int, c284 int, c283 int, c282 int, c281 int, c280 int, c279 int, c278 int, c277 int, c276 int, c275 int, c274 int, c273 int, c272 int, c271 int, c270 int, c269 int, c268 int, c267 int, c266 int, c265 int, c264 int, c263 int, c262 int, c261 int, c260 int, c259 int, c258 int, c257 int, c256 int, c255 int, c254 int, c253 int, c252 int, c251 int, c250 int, c249 int, c248 int, c247 int, c246 int, c245 int, c244 int, c243 int, c242 int, c241 int, c240 int, c239 int, c238 int, c237 int, c236 int, c235 int, c234 int, c233 int, c232 int, c231 int, c230 int, c229 int, c228 int, c227 int, c226 int, c225 int, c224 int, c223 int, c222 int, c221 int, c220 int, c219 int, c218 int, c217 int, c216 int, c215 int, c214 int, c213 int, c212 int, c211 int, c210 int, c209 int, c208 int, c207 int, c206 int, c205 int, c204 int, c203 int, c202 int, c201 int, c200 int, c199 int, c198 int, c197 int, c196 int, c195 int, c194 int, c193 int, c192 int, c191 int, c190 int, c189 int, c188 int, c187 int, c186 int, c185 int, c184 int, c183 int, c182 int, c181 int, c180 int, c179 int, c178 int, c177 int, c176 int, c175 int, c174 int, c173 int, c172 int, c171 int, c170 int, c169 int, c168 int, c167 int, c166 int, c165 int, c164 int, c163 int, c162 int, c161 int, c160 int, c159 int, c158 int, c157 int, c156 int, c155 int, c154 int, c153 int, c152 int, c151 int, c150 int, c149 int, c148 int, c147 int, c146 int, c145 int, c144 int, c143 int, c142 int, c141 int, c140 int, c139 int, c138 int, c137 int, c136 int, c135 int, c134 int, c133 int, c132 int, c131 int, c130 int, c129 int, c128 int, c127 int, c126 int, c125 int, c124 int, c123 int, c122 int, c121 int, c120 int, c119 int, c118 int, c117 int, c116 int, c115 int, c114 int, c113 int, c112 int, c111 int, c110 int, c109 int, c108 int, c107 int, c106 int, c105 int, c104 int, c103 int, c102 int, c101 int, c100 int, c99 int, c98 int, c97 int, c96 int, c95 int, c94 int, c93 int, c92 int, c91 int, c90 int, c89 int, c88 int, c87 int, c86 int, c85 int, c84 int, c83 int, c82 int, c81 int, c80 int, c79 int, c78 int, c77 int, c76 int, c75 int, c74 int, c73 int, c72 int, c71 int, c70 int, c69 int, c68 int, c67 int, c66 int, c65 int, c64 int, c63 int, c62 int, c61 int, c60 int, c59 int, c58 int, c57 int, c56 int, c55 int, c54 int, c53 int, c52 int, c51 int, c50 int, c49 int, c48 int, c47 int, c46 int, c45 int, c44 int, c43 int, c42 int, c41 int, c40 int, c39 int, c38 int, c37 int, c36 int, c35 int, c34 int, c33 int, c32 int, c31 int, c30 int, c29 int, c28 int, c27 int, c26 int, c25 int, c24 int, c23 int, c22 int, c21 int, c20 int, c19 int, c18 int, c17 int, c16 int, c15 int, c14 int, c13 int, c12 int, c11 int, c10 int, c9 int, c8 int, c7 int, c6 int, c5 int, c4 int, c3 int, c2 int, c1 int, c512 varchar(10000), primary key using hash(c1)) engine=ndb charset=latin1 partition by key(c1);
428 set @v10 = '0123456789';
429 set @v100 = concat(@v10,@v10,@v10,@v10,@v10,@v10,@v10,@v10,@v10,@v10);
430 set @v1000 =concat(@v100,@v100,@v100,@v100,@v100,@v100,@v100,@v100,@v100,@v100);
431 set @v10000 = concat(@v1000,@v1000,@v1000,@v1000,@v1000,@v1000,@v1000,@v1000,@v1000,@v1000);
432 set @v13000 = concat(@v10000, @v1000,@v1000,@v1000);
433 insert into t1 (c1,c512) values (1,@v10000), (2,@v10000), (3,@v10000);
434 select c1, length(c512) from t1 order by 1;
435 c1 length(c512)
436 1 10000
437 2 10000
438 3 10000
439 delete from t1;
440 drop table t1;
441 create table t1 ( c511 int column_format dynamic, c510 int column_format dynamic, c509 int column_format dynamic, c508 int column_format dynamic, c507 int column_format dynamic, c506 int column_format dynamic, c505 int column_format dynamic, c504 int column_format dynamic, c503 int column_format dynamic, c502 int column_format dynamic, c501 int column_format dynamic, c500 int column_format dynamic, c499 int column_format dynamic, c498 int column_format dynamic, c497 int column_format dynamic, c496 int column_format dynamic, c495 int column_format dynamic, c494 int column_format dynamic, c493 int column_format dynamic, c492 int column_format dynamic, c491 int column_format dynamic, c490 int column_format dynamic, c489 int column_format dynamic, c488 int column_format dynamic, c487 int column_format dynamic, c486 int column_format dynamic, c485 int column_format dynamic, c484 int column_format dynamic, c483 int column_format dynamic, c482 int column_format dynamic, c481 int column_format dynamic, c480 int column_format dynamic, c479 int column_format dynamic, c478 int column_format dynamic, c477 int column_format dynamic, c476 int column_format dynamic, c475 int column_format dynamic, c474 int column_format dynamic, c473 int column_format dynamic, c472 int column_format dynamic, c471 int column_format dynamic, c470 int column_format dynamic, c469 int column_format dynamic, c468 int column_format dynamic, c467 int column_format dynamic, c466 int column_format dynamic, c465 int column_format dynamic, c464 int column_format dynamic, c463 int column_format dynamic, c462 int column_format dynamic, c461 int column_format dynamic, c460 int column_format dynamic, c459 int column_format dynamic, c458 int column_format dynamic, c457 int column_format dynamic, c456 int column_format dynamic, c455 int column_format dynamic, c454 int column_format dynamic, c453 int column_format dynamic, c452 int column_format dynamic, c451 int column_format dynamic, c450 int column_format dynamic, c449 int column_format dynamic, c448 int column_format dynamic, c447 int column_format dynamic, c446 int column_format dynamic, c445 int column_format dynamic, c444 int column_format dynamic, c443 int column_format dynamic, c442 int column_format dynamic, c441 int column_format dynamic, c440 int column_format dynamic, c439 int column_format dynamic, c438 int column_format dynamic, c437 int column_format dynamic, c436 int column_format dynamic, c435 int column_format dynamic, c434 int column_format dynamic, c433 int column_format dynamic, c432 int column_format dynamic, c431 int column_format dynamic, c430 int column_format dynamic, c429 int column_format dynamic, c428 int column_format dynamic, c427 int column_format dynamic, c426 int column_format dynamic, c425 int column_format dynamic, c424 int column_format dynamic, c423 int column_format dynamic, c422 int column_format dynamic, c421 int column_format dynamic, c420 int column_format dynamic, c419 int column_format dynamic, c418 int column_format dynamic, c417 int column_format dynamic, c416 int column_format dynamic, c415 int column_format dynamic, c414 int column_format dynamic, c413 int column_format dynamic, c412 int column_format dynamic, c411 int column_format dynamic, c410 int column_format dynamic, c409 int column_format dynamic, c408 int column_format dynamic, c407 int column_format dynamic, c406 int column_format dynamic, c405 int column_format dynamic, c404 int column_format dynamic, c403 int column_format dynamic, c402 int column_format dynamic, c401 int column_format dynamic, c400 int column_format dynamic, c399 int column_format dynamic, c398 int column_format dynamic, c397 int column_format dynamic, c396 int column_format dynamic, c395 int column_format dynamic, c394 int column_format dynamic, c393 int column_format dynamic, c392 int column_format dynamic, c391 int column_format dynamic, c390 int column_format dynamic, c389 int column_format dynamic, c388 int column_format dynamic, c387 int column_format dynamic, c386 int column_format dynamic, c385 int column_format dynamic, c384 int column_format dynamic, c383 int column_format dynamic, c382 int column_format dynamic, c381 int column_format dynamic, c380 int column_format dynamic, c379 int column_format dynamic, c378 int column_format dynamic, c377 int column_format dynamic, c376 int column_format dynamic, c375 int column_format dynamic, c374 int column_format dynamic, c373 int column_format dynamic, c372 int column_format dynamic, c371 int column_format dynamic, c370 int column_format dynamic, c369 int column_format dynamic, c368 int column_format dynamic, c367 int column_format dynamic, c366 int column_format dynamic, c365 int column_format dynamic, c364 int column_format dynamic, c363 int column_format dynamic, c362 int column_format dynamic, c361 int column_format dynamic, c360 int column_format dynamic, c359 int column_format dynamic, c358 int column_format dynamic, c357 int column_format dynamic, c356 int column_format dynamic, c355 int column_format dynamic, c354 int column_format dynamic, c353 int column_format dynamic, c352 int column_format dynamic, c351 int column_format dynamic, c350 int column_format dynamic, c349 int column_format dynamic, c348 int column_format dynamic, c347 int column_format dynamic, c346 int column_format dynamic, c345 int column_format dynamic, c344 int column_format dynamic, c343 int column_format dynamic, c342 int column_format dynamic, c341 int column_format dynamic, c340 int column_format dynamic, c339 int column_format dynamic, c338 int column_format dynamic, c337 int column_format dynamic, c336 int column_format dynamic, c335 int column_format dynamic, c334 int column_format dynamic, c333 int column_format dynamic, c332 int column_format dynamic, c331 int column_format dynamic, c330 int column_format dynamic, c329 int column_format dynamic, c328 int column_format dynamic, c327 int column_format dynamic, c326 int column_format dynamic, c325 int column_format dynamic, c324 int column_format dynamic, c323 int column_format dynamic, c322 int column_format dynamic, c321 int column_format dynamic, c320 int column_format dynamic, c319 int column_format dynamic, c318 int column_format dynamic, c317 int column_format dynamic, c316 int column_format dynamic, c315 int column_format dynamic, c314 int column_format dynamic, c313 int column_format dynamic, c312 int column_format dynamic, c311 int column_format dynamic, c310 int column_format dynamic, c309 int column_format dynamic, c308 int column_format dynamic, c307 int column_format dynamic, c306 int column_format dynamic, c305 int column_format dynamic, c304 int column_format dynamic, c303 int column_format dynamic, c302 int column_format dynamic, c301 int column_format dynamic, c300 int column_format dynamic, c299 int column_format dynamic, c298 int column_format dynamic, c297 int column_format dynamic, c296 int column_format dynamic, c295 int column_format dynamic, c294 int column_format dynamic, c293 int column_format dynamic, c292 int column_format dynamic, c291 int column_format dynamic, c290 int column_format dynamic, c289 int column_format dynamic, c288 int column_format dynamic, c287 int column_format dynamic, c286 int column_format dynamic, c285 int column_format dynamic, c284 int column_format dynamic, c283 int column_format dynamic, c282 int column_format dynamic, c281 int column_format dynamic, c280 int column_format dynamic, c279 int column_format dynamic, c278 int column_format dynamic, c277 int column_format dynamic, c276 int column_format dynamic, c275 int column_format dynamic, c274 int column_format dynamic, c273 int column_format dynamic, c272 int column_format dynamic, c271 int column_format dynamic, c270 int column_format dynamic, c269 int column_format dynamic, c268 int column_format dynamic, c267 int column_format dynamic, c266 int column_format dynamic, c265 int column_format dynamic, c264 int column_format dynamic, c263 int column_format dynamic, c262 int column_format dynamic, c261 int column_format dynamic, c260 int column_format dynamic, c259 int column_format dynamic, c258 int column_format dynamic, c257 int column_format dynamic, c256 int column_format dynamic, c255 int column_format dynamic, c254 int column_format dynamic, c253 int column_format dynamic, c252 int column_format dynamic, c251 int column_format dynamic, c250 int column_format dynamic, c249 int column_format dynamic, c248 int column_format dynamic, c247 int column_format dynamic, c246 int column_format dynamic, c245 int column_format dynamic, c244 int column_format dynamic, c243 int column_format dynamic, c242 int column_format dynamic, c241 int column_format dynamic, c240 int column_format dynamic, c239 int column_format dynamic, c238 int column_format dynamic, c237 int column_format dynamic, c236 int column_format dynamic, c235 int column_format dynamic, c234 int column_format dynamic, c233 int column_format dynamic, c232 int column_format dynamic, c231 int column_format dynamic, c230 int column_format dynamic, c229 int column_format dynamic, c228 int column_format dynamic, c227 int column_format dynamic, c226 int column_format dynamic, c225 int column_format dynamic, c224 int column_format dynamic, c223 int column_format dynamic, c222 int column_format dynamic, c221 int column_format dynamic, c220 int column_format dynamic, c219 int column_format dynamic, c218 int column_format dynamic, c217 int column_format dynamic, c216 int column_format dynamic, c215 int column_format dynamic, c214 int column_format dynamic, c213 int column_format dynamic, c212 int column_format dynamic, c211 int column_format dynamic, c210 int column_format dynamic, c209 int column_format dynamic, c208 int column_format dynamic, c207 int column_format dynamic, c206 int column_format dynamic, c205 int column_format dynamic, c204 int column_format dynamic, c203 int column_format dynamic, c202 int column_format dynamic, c201 int column_format dynamic, c200 int column_format dynamic, c199 int column_format dynamic, c198 int column_format dynamic, c197 int column_format dynamic, c196 int column_format dynamic, c195 int column_format dynamic, c194 int column_format dynamic, c193 int column_format dynamic, c192 int column_format dynamic, c191 int column_format dynamic, c190 int column_format dynamic, c189 int column_format dynamic, c188 int column_format dynamic, c187 int column_format dynamic, c186 int column_format dynamic, c185 int column_format dynamic, c184 int column_format dynamic, c183 int column_format dynamic, c182 int column_format dynamic, c181 int column_format dynamic, c180 int column_format dynamic, c179 int column_format dynamic, c178 int column_format dynamic, c177 int column_format dynamic, c176 int column_format dynamic, c175 int column_format dynamic, c174 int column_format dynamic, c173 int column_format dynamic, c172 int column_format dynamic, c171 int column_format dynamic, c170 int column_format dynamic, c169 int column_format dynamic, c168 int column_format dynamic, c167 int column_format dynamic, c166 int column_format dynamic, c165 int column_format dynamic, c164 int column_format dynamic, c163 int column_format dynamic, c162 int column_format dynamic, c161 int column_format dynamic, c160 int column_format dynamic, c159 int column_format dynamic, c158 int column_format dynamic, c157 int column_format dynamic, c156 int column_format dynamic, c155 int column_format dynamic, c154 int column_format dynamic, c153 int column_format dynamic, c152 int column_format dynamic, c151 int column_format dynamic, c150 int column_format dynamic, c149 int column_format dynamic, c148 int column_format dynamic, c147 int column_format dynamic, c146 int column_format dynamic, c145 int column_format dynamic, c144 int column_format dynamic, c143 int column_format dynamic, c142 int column_format dynamic, c141 int column_format dynamic, c140 int column_format dynamic, c139 int column_format dynamic, c138 int column_format dynamic, c137 int column_format dynamic, c136 int column_format dynamic, c135 int column_format dynamic, c134 int column_format dynamic, c133 int column_format dynamic, c132 int column_format dynamic, c131 int column_format dynamic, c130 int column_format dynamic, c129 int column_format dynamic, c128 int column_format dynamic, c127 int column_format dynamic, c126 int column_format dynamic, c125 int column_format dynamic, c124 int column_format dynamic, c123 int column_format dynamic, c122 int column_format dynamic, c121 int column_format dynamic, c120 int column_format dynamic, c119 int column_format dynamic, c118 int column_format dynamic, c117 int column_format dynamic, c116 int column_format dynamic, c115 int column_format dynamic, c114 int column_format dynamic, c113 int column_format dynamic, c112 int column_format dynamic, c111 int column_format dynamic, c110 int column_format dynamic, c109 int column_format dynamic, c108 int column_format dynamic, c107 int column_format dynamic, c106 int column_format dynamic, c105 int column_format dynamic, c104 int column_format dynamic, c103 int column_format dynamic, c102 int column_format dynamic, c101 int column_format dynamic, c100 int column_format dynamic, c99 int column_format dynamic, c98 int column_format dynamic, c97 int column_format dynamic, c96 int column_format dynamic, c95 int column_format dynamic, c94 int column_format dynamic, c93 int column_format dynamic, c92 int column_format dynamic, c91 int column_format dynamic, c90 int column_format dynamic, c89 int column_format dynamic, c88 int column_format dynamic, c87 int column_format dynamic, c86 int column_format dynamic, c85 int column_format dynamic, c84 int column_format dynamic, c83 int column_format dynamic, c82 int column_format dynamic, c81 int column_format dynamic, c80 int column_format dynamic, c79 int column_format dynamic, c78 int column_format dynamic, c77 int column_format dynamic, c76 int column_format dynamic, c75 int column_format dynamic, c74 int column_format dynamic, c73 int column_format dynamic, c72 int column_format dynamic, c71 int column_format dynamic, c70 int column_format dynamic, c69 int column_format dynamic, c68 int column_format dynamic, c67 int column_format dynamic, c66 int column_format dynamic, c65 int column_format dynamic, c64 int column_format dynamic, c63 int column_format dynamic, c62 int column_format dynamic, c61 int column_format dynamic, c60 int column_format dynamic, c59 int column_format dynamic, c58 int column_format dynamic, c57 int column_format dynamic, c56 int column_format dynamic, c55 int column_format dynamic, c54 int column_format dynamic, c53 int column_format dynamic, c52 int column_format dynamic, c51 int column_format dynamic, c50 int column_format dynamic, c49 int column_format dynamic, c48 int column_format dynamic, c47 int column_format dynamic, c46 int column_format dynamic, c45 int column_format dynamic, c44 int column_format dynamic, c43 int column_format dynamic, c42 int column_format dynamic, c41 int column_format dynamic, c40 int column_format dynamic, c39 int column_format dynamic, c38 int column_format dynamic, c37 int column_format dynamic, c36 int column_format dynamic, c35 int column_format dynamic, c34 int column_format dynamic, c33 int column_format dynamic, c32 int column_format dynamic, c31 int column_format dynamic, c30 int column_format dynamic, c29 int column_format dynamic, c28 int column_format dynamic, c27 int column_format dynamic, c26 int column_format dynamic, c25 int column_format dynamic, c24 int column_format dynamic, c23 int column_format dynamic, c22 int column_format dynamic, c21 int column_format dynamic, c20 int column_format dynamic, c19 int column_format dynamic, c18 int column_format dynamic, c17 int column_format dynamic, c16 int column_format dynamic, c15 int column_format dynamic, c14 int column_format dynamic, c13 int column_format dynamic, c12 int column_format dynamic, c11 int column_format dynamic, c10 int column_format dynamic, c9 int column_format dynamic, c8 int column_format dynamic, c7 int column_format dynamic, c6 int column_format dynamic, c5 int column_format dynamic, c4 int column_format dynamic, c3 int column_format dynamic, c2 int column_format dynamic, c1 int column_format dynamic, c512 varchar(10000), primary key using hash(c1)) engine=ndb charset=latin1 partition by key(c1);
442 set @v10 = '0123456789';
443 set @v100 = concat(@v10,@v10,@v10,@v10,@v10,@v10,@v10,@v10,@v10,@v10);
444 set @v1000 = concat(@v100,@v100,@v100,@v100,@v100,@v100,@v100,@v100,@v100,@v100);
445 set @v10000 = concat(@v1000,@v1000,@v1000,@v1000,@v1000,@v1000,@v1000,@v1000,@v1000,@v1000);
446 set @v13000 = concat(@v10000, @v1000,@v1000,@v1000);
447 insert into t1 (c1,c512) values (1,@v10000), (2,@v10000), (3,@v10000);
448 select c1, length(c512) from t1 order by 1;
449 c1 length(c512)
450 1 10000
451 2 10000
452 3 10000
453 delete from t1;
454 drop table t1;
455 create table t1 (
456 a int primary key,
457 b varchar(13000)
458 ) engine = ndb charset=latin1;
459 insert into t1 values (1,@v13000), (2,@v13000);
460 select length(b) from t1 order by 1;
461 length(b)
462 13000
463 13000
464 drop table t1;
465 create table t1 ( c50 char(255) column_format fixed, c49 char(255) column_format fixed, c48 char(255) column_format fixed, c47 char(255) column_format fixed, c46 char(255) column_format fixed, c45 char(255) column_format fixed, c44 char(255) column_format fixed, c43 char(255) column_format fixed, c42 char(255) column_format fixed, c41 char(255) column_format fixed, c40 char(255) column_format fixed, c39 char(255) column_format fixed, c38 char(255) column_format fixed, c37 char(255) column_format fixed, c36 char(255) column_format fixed, c35 char(255) column_format fixed, c34 char(255) column_format fixed, c33 char(255) column_format fixed, c32 char(255) column_format fixed, c31 char(255) column_format fixed, c30 char(255) column_format fixed, c29 char(255) column_format fixed, c28 char(255) column_format fixed, c27 char(255) column_format fixed, c26 char(255) column_format fixed, c25 char(255) column_format fixed, c24 char(255) column_format fixed, c23 char(255) column_format fixed, c22 char(255) column_format fixed, c21 char(255) column_format fixed, c20 char(255) column_format fixed, c19 char(255) column_format fixed, c18 char(255) column_format fixed, c17 char(255) column_format fixed, c16 char(255) column_format fixed, c15 char(255) column_format fixed, c14 char(255) column_format fixed, c13 char(255) column_format fixed, c12 char(255) column_format fixed, c11 char(255) column_format fixed, c10 char(255) column_format fixed, c9 char(255) column_format fixed, c8 char(255) column_format fixed, c7 char(255) column_format fixed, c6 char(255) column_format fixed, c5 char(255) column_format fixed, c4 char(255) column_format fixed, c3 char(255) column_format fixed, c2 char(255) column_format fixed, c1 char(255) column_format fixed, primary key using hash(c1)) engine=ndb charset=latin1;
466 ERROR HY000: Can't create table 't1' (use SHOW WARNINGS for more info).
467 show warnings;
468 Level Code Message
469 Warning 1296 Got error 851 'Fixed-size column offset exceeded max.Use VARCHAR or COLUMN_FORMAT DYNAMIC for memory-stored columns' from NDB
470 Warning 1296 Failed to commit NDB schema transaction
471 Error 1005 Can't create table 't1' (use SHOW WARNINGS for more info).
472 create table `t1` (`a` int, b int, primary key (a,b)) engine=ndb partition by key(`a`,`b`,`a`);
473 ERROR HY000: Duplicate partition field name 'a'
474 create table t1 (
475 a1234567890123456789012345678901234567890 int primary key,
476 a12345678901234567890123456789a1234567890 int,
477 index(a12345678901234567890123456789a1234567890)
478 ) engine=ndb
479 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
480 show tables;
481 Tables_in_test
482 t1
483 insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
484 explain select * from t1 where a12345678901234567890123456789a1234567890=2;
485 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
486 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11 ref a12345678901234567890123456789a1234567890 a12345678901234567890123456789a1234567890 5 const # # NULL
487 Warnings:
488 Note 1003 /* select#1 */ select `test`.`t1`.`a1234567890123456789012345678901234567890` AS `a1234567890123456789012345678901234567890`,`test`.`t1`.`a12345678901234567890123456789a1234567890` AS `a12345678901234567890123456789a1234567890` from `test`.`t1` where (`test`.`t1`.`a12345678901234567890123456789a1234567890` = 2)
489 select * from t1 where a12345678901234567890123456789a1234567890=2;
490 a1234567890123456789012345678901234567890 a12345678901234567890123456789a1234567890
491 5 2
492 drop table t1;
493 create table t1
494 (a bigint, b bigint, c bigint, d bigint,
495 primary key (a,b,c,d))
496 engine=ndb
497 max_rows=800000000;
498 Warnings:
499 Warning 1105 Ndb might have problems storing the max amount of rows specified
500 insert into t1 values
501 (1,2,3,4),(2,3,4,5),(3,4,5,6),
502 (3,2,3,4),(1,3,4,5),(2,4,5,6),
503 (1,2,3,5),(2,3,4,8),(3,4,5,9),
504 (3,2,3,5),(1,3,4,8),(2,4,5,9),
505 (1,2,3,6),(2,3,4,6),(3,4,5,7),
506 (3,2,3,6),(1,3,4,6),(2,4,5,7),
507 (1,2,3,7),(2,3,4,7),(3,4,5,8),
508 (3,2,3,7),(1,3,4,7),(2,4,5,8),
509 (1,3,3,4),(2,4,4,5),(3,5,5,6),
510 (3,3,3,4),(1,4,4,5),(2,5,5,6),
511 (1,3,3,5),(2,4,4,8),(3,5,5,9),
512 (3,3,3,5),(1,4,4,8),(2,5,5,9),
513 (1,3,3,6),(2,4,4,6),(3,5,5,7),
514 (3,3,3,6),(1,4,4,6),(2,5,5,7),
515 (1,3,3,7),(2,4,4,7),(3,5,5,8),
516 (3,3,3,7),(1,4,4,7),(2,5,5,8);
517 select count(*) from t1;
518 count(*)
519 48
520 select count(*) into @cnt_big
521 from information_schema.partitions
522 where table_schema = 'test' and table_name = 't1';
523 drop table t1;
524 create table t1
525 (a bigint, b bigint, c bigint, d bigint,
526 primary key (a,b,c,d))
527 engine=ndb
528 max_rows=1;
529 insert into t1 values
530 (1,2,3,4),(2,3,4,5),(3,4,5,6),
531 (3,2,3,4),(1,3,4,5),(2,4,5,6),
532 (1,2,3,5),(2,3,4,8),(3,4,5,9),
533 (3,2,3,5),(1,3,4,8),(2,4,5,9),
534 (1,2,3,6),(2,3,4,6),(3,4,5,7),
535 (3,2,3,6),(1,3,4,6),(2,4,5,7),
536 (1,2,3,7),(2,3,4,7),(3,4,5,8),
537 (3,2,3,7),(1,3,4,7),(2,4,5,8),
538 (1,3,3,4),(2,4,4,5),(3,5,5,6),
539 (3,3,3,4),(1,4,4,5),(2,5,5,6),
540 (1,3,3,5),(2,4,4,8),(3,5,5,9),
541 (3,3,3,5),(1,4,4,8),(2,5,5,9),
542 (1,3,3,6),(2,4,4,6),(3,5,5,7),
543 (3,3,3,6),(1,4,4,6),(2,5,5,7),
544 (1,3,3,7),(2,4,4,7),(3,5,5,8),
545 (3,3,3,7),(1,4,4,7),(2,5,5,8);
546 select count(*) into @cnt_small
547 from information_schema.partitions
548 where table_schema = 'test' and table_name = 't1';
549 drop table t1;
550 select @cnt_big > @cnt_small;
551 @cnt_big > @cnt_small
552 1
553 create table t1
554 (counter int(64) NOT NULL auto_increment,
555 datavalue char(40) default 'XXXX',
556 primary key (counter)
557 ) ENGINE=ndbcluster;
558 Warnings:
559 Warning 1681 Integer display width is deprecated and will be removed in a future release.
560 insert into t1 (datavalue) values ('newval');
561 insert into t1 (datavalue) values ('newval');
562 select * from t1 order by counter;
563 counter datavalue
564 1 newval
565 2 newval
566 insert into t1 (datavalue) select datavalue from t1 where counter < 100;
567 insert into t1 (datavalue) select datavalue from t1 where counter < 100;
568 select * from t1 order by counter;
569 counter datavalue
570 1 newval
571 2 newval
572 3 newval
573 4 newval
574 5 newval
575 6 newval
576 7 newval
577 8 newval
578 insert into t1 (datavalue) select datavalue from t1 where counter < 100;
579 insert into t1 (datavalue) select datavalue from t1 where counter < 100;
580 select * from t1 order by counter;
581 counter datavalue
582 1 newval
583 2 newval
584 3 newval
585 4 newval
586 5 newval
587 6 newval
588 7 newval
589 8 newval
590 9 newval
591 10 newval
592 11 newval
593 12 newval
594 13 newval
595 14 newval
596 15 newval
597 16 newval
598 17 newval
599 18 newval
600 19 newval
601 20 newval
602 21 newval
603 22 newval
604 23 newval
605 24 newval
606 25 newval
607 26 newval
608 27 newval
609 28 newval
610 29 newval
611 30 newval
612 31 newval
613 32 newval
614 drop table t1;
615 create table t1 (a int primary key auto_increment) engine = ndb;
616 insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
617 insert into t1(a) values (20),(28);
618 insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
619 insert into t1() values (21), (22);
620 drop table t1;
621 CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
622 select * from t1;
623 b
624 drop table t1;
625 create table t1 (a int) engine=ndb;
626 create table t2 (a int) engine=ndb;
627 insert into t1 values (1);
628 insert into t2 values (1);
629 delete t1.* from t1, t2 where t1.a = t2.a;
630 select * from t1;
631 a
632 select * from t2;
633 a
634 1
635 drop table t1;
636 drop table t2;
637 CREATE TABLE t1 (
638 i INT,
639 j INT,
640 x INT,
641 y INT,
642 z INT
643 ) engine=ndb;
644 CREATE TABLE t2 (
645 i INT,
646 k INT,
647 x INT,
648 y INT,
649 z INT
650 ) engine=ndb;
651 CREATE TABLE t3 (
652 j INT,
653 k INT,
654 x INT,
655 y INT,
656 z INT
657 ) engine=ndb;
658 INSERT INTO t1 VALUES ( 1, 2,13,14,15);
659 INSERT INTO t2 VALUES ( 1, 3,23,24,25);
660 INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
661 UPDATE t1 AS a
662 INNER JOIN t2 AS b
663 ON a.i = b.i
664 INNER JOIN t3 AS c
665 ON a.j = c.j AND b.k = c.k
666 SET a.x = b.x,
667 a.y = b.y,
668 a.z = (
669 SELECT sum(z)
670 FROM t3
671 WHERE y = 34
672 )
673 WHERE b.x = 23;
674 select * from t1;
675 i j x y z
676 1 2 23 24 71
677 drop table t1;
678 drop table t2;
679 drop table t3;
680 create table atablewithareallylongandirritatingname (a int);
681 insert into atablewithareallylongandirritatingname values (2);
682 select * from atablewithareallylongandirritatingname;
683 a
684 2
685 drop table atablewithareallylongandirritatingname;
686 create table t1 (f1 varchar(50), f2 text,f3 int, primary key(f1)) engine=NDB;
687 insert into t1 (f1,f2,f3)VALUES("111111","aaaaaa",1);
688 insert into t1 (f1,f2,f3)VALUES("222222","bbbbbb",2);
689 select * from t1 order by f1;
690 f1 f2 f3
691 111111 aaaaaa 1
692 222222 bbbbbb 2
693 select * from t1 order by f2;
694 f1 f2 f3
695 111111 aaaaaa 1
696 222222 bbbbbb 2
697 select * from t1 order by f3;
698 f1 f2 f3
699 111111 aaaaaa 1
700 222222 bbbbbb 2
701 drop table t1;
702 CREATE TABLE t1 (
703 a VARBINARY(40) NOT NULL,
704 b VARCHAR (256) CHARACTER SET UTF8 NOT NULL,
705 c VARCHAR(256) CHARACTER SET UTF8 NOT NULL,
706 PRIMARY KEY (b,c)) ENGINE=ndbcluster;
707 Warnings:
708 Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
709 Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
710 INSERT INTO t1 VALUES
711 ("a","ab","abc"),("b","abc","abcd"),("c","abc","ab"),("d","ab","ab"),("e","abc","abc");
712 SELECT * FROM t1 ORDER BY a;
713 a b c
714 a ab abc
715 b abc abcd
716 c abc ab
717 d ab ab
718 e abc abc
719 DROP TABLE t1;
720 create table t1 (a int not null primary key, b int not null) engine=ndb;
721 create table t2 (a int not null primary key, b int not null) engine=ndb;
722 insert into t1 values (1,10), (2,20), (3,30);
723 insert into t2 values (1,10), (2,20), (3,30);
724 select * from t1 order by a;
725 a b
726 1 10
727 2 20
728 3 30
729 delete from t1 where a > 0 order by a desc limit 1;
730 select * from t1 order by a;
731 a b
732 1 10
733 2 20
734 delete from t1,t2 using t1,t2 where t1.a = t2.a;
735 select * from t2 order by a;
736 a b
737 3 30
738 drop table t1,t2;
739 create table t1 (a int not null primary key, b int not null) engine=ndb;
740 insert into t1 values (1,10), (2,20), (3,30);
741 insert into t1 set a=1, b=100;
742 ERROR 23000: Duplicate entry '1' for key 't1.PRIMARY'
743 insert ignore into t1 set a=1, b=100;
744 Warnings:
745 Warning 1062 Duplicate entry '1' for key 't1.PRIMARY'
746 select * from t1 order by a;
747 a b
748 1 10
749 2 20
750 3 30
751 insert into t1 set a=1, b=1000 on duplicate key update b=b+1;
752 select * from t1 order by a;
753 a b
754 1 11
755 2 20
756 3 30
757 drop table t1;
758 create table t1 (a int not null primary key, b int not null) engine=ndb;
759 create table t2 (c int not null primary key, d int not null) engine=ndb;
760 insert into t1 values (1,10), (2,10), (3,30), (4, 30);
761 insert into t2 values (1,10), (2,10), (3,30), (4, 30);
762 update t1 set a = 1 where a = 3;
763 ERROR 23000: Duplicate entry '1' for key 't1.PRIMARY'
764 select * from t1 order by a;
765 a b
766 1 10
767 2 10
768 3 30
769 4 30
770 update t1 set b = 1 where a > 1 order by a desc limit 1;
771 select * from t1 order by a;
772 a b
773 1 10
774 2 10
775 3 30
776 4 1
777 update t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
778 ERROR 23000: Duplicate entry '1' for key 't1.PRIMARY'
779 select * from t1 order by a;
780 a b
781 1 10
782 2 10
783 3 30
784 4 1
785 update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
786 Warnings:
787 Warning 1062 Duplicate entry '1' for key 't1.PRIMARY'
788 Warning 1062 Duplicate entry '1' for key 't2.PRIMARY'
789 select * from t1 order by a;
790 a b
791 1 10
792 2 10
793 3 30
794 4 1
795 drop table t1,t2;
796 create table t1 (a varchar(100) primary key, b varchar(100)) engine = NDB;
797 insert into t1 values
798 ('a', 'a'),('b','b'),('c', 'c'),('aa', 'aa'),('bb', 'bb'),('cc', 'cc');
799 replace into t1 values ('a', '-a');
800 replace into t1 values ('b', '-b');
801 replace into t1 values ('c', '-c');
802 replace into t1 values ('aa', '-aa');
803 replace into t1 values ('bb', '-bb');
804 replace into t1 values ('cc', '-cc');
805 replace into t1 values ('aaa', '-aaa');
806 replace into t1 values ('bbb', '-bbb');
807 replace into t1 values ('ccc', '-ccc');
808 select * from t1 order by 1,2;
809 a b
810 a -a
811 aa -aa
812 aaa -aaa
813 b -b
814 bb -bb
815 bbb -bbb
816 c -c
817 cc -cc
818 ccc -ccc
819 drop table t1;
820 CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
821 CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
822 CREATE TABLE t2(a VARCHAR(255) NOT NULL,
823 b VARCHAR(255) NOT NULL,
824 c VARCHAR(255) NOT NULL,
825 CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
826 CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
827 drop table t2, t1;
828 create table t1 (a int not null primary key, b int) engine=ndb;
829 insert into t1 values(1,1),(2,2),(3,3);
830 create table t2 like t1;
831 insert into t2 select * from t1;
832 select * from t1 order by a;
833 a b
834 1 1
835 2 2
836 3 3
837 select * from t2 order by a;
838 a b
839 1 1
840 2 2
841 3 3
842 drop table t1, t2;
843 create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
844 create table if not exists t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
845 create table t2 like t1;
846 rename table t1 to t10, t2 to t20;
847 drop table t10,t20;
848 #
849 # bug #39872 - explain causes segv
850 # (ndb_index_stat_enable=1 must be set to trigger bug)
851 # index stats v4: do not set, the v2 setting was local
852 #
853 CREATE TABLE `t1` (
854 `id` int(11) NOT NULL AUTO_INCREMENT,
855 PRIMARY KEY (`id`)
856 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8
857 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
858 Warnings:
859 Warning 1681 Integer display width is deprecated and will be removed in a future release.
860 Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
861 CREATE TABLE `t2` (
862 `id` int(11) NOT NULL,
863 `obj_id` int(11) DEFAULT NULL,
864 UNIQUE KEY `id` (`id`),
865 KEY `obj_id` (`obj_id`)
866 ) ENGINE=ndbcluster DEFAULT CHARSET=utf8
867 comment="NDB_TABLE=PARTITION_BALANCE=FOR_RP_BY_LDM";
868 Warnings:
869 Warning 1681 Integer display width is deprecated and will be removed in a future release.
870 Warning 1681 Integer display width is deprecated and will be removed in a future release.
871 Warning 3719 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
872 # here we used to segv
873 explain SELECT t1.id FROM t1 INNER JOIN t2 ON t1.id = t2.id WHERE t2.obj_id=1;
874 id select_type table partitions type possible_keys key key_len ref rows filtered Extra
875 1 SIMPLE t2 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11 ref id,obj_id obj_id 5 const # # Parent of 2 pushed join@1
876 1 SIMPLE t1 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11 eq_ref PRIMARY PRIMARY 4 test.t2.id # # Child of 't2' in pushed join@1
877 Warnings:
878 Note 1003 /* select#1 */ select `test`.`t1`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`id` = `test`.`t2`.`id`) and (`test`.`t2`.`obj_id` = 1))
879 drop table t1, t2;
880 #
881 # Bug #47054 Cluster only deletes first matched row in delete with left join
882 #
883 CREATE TABLE child
884 ( id INT AUTO_INCREMENT PRIMARY KEY
885 , parent_id INT
886 ) ENGINE=ndb;
887 CREATE TABLE parent
888 ( id INT AUTO_INCREMENT PRIMARY KEY
889 ) ENGINE=ndb;
890 INSERT INTO parent VALUES (NULL),(NULL),(NULL);
891 INSERT INTO child VALUES (NULL, 1),(NULL,2),(NULL,3),(NULL,4),(NULL,5);
892 SELECT * FROM child ORDER BY id;
893 id parent_id
894 1 1
895 2 2
896 3 3
897 4 4
898 5 5
899 SELECT *
900 FROM child AS c
901 LEFT JOIN parent AS p ON c.parent_id = p.id
902 WHERE p.id IS NULL AND c.id < 100 ORDER BY c.id;
903 id parent_id id
904 4 4 NULL
905 5 5 NULL
906 DELETE c.*
907 FROM child AS c
908 LEFT JOIN parent AS p ON c.parent_id = p.id
909 WHERE p.id IS NULL AND c.id < 100;
910 SELECT * FROM child ORDER BY id;
911 id parent_id
912 1 1
913 2 2
914 3 3
915 DROP TABLE child, parent;
916 CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT)
917 ENGINE=ndb PARTITION BY KEY(a) PARTITIONS 144;
918 ERROR HY000: Can't create table 't1' (use SHOW WARNINGS for more info).
919 show warnings;
920 Level Code Message
921 Warning 1296 Got error 1224 'Too many fragments' from NDB
922 Warning 1296 Failed to commit NDB schema transaction
923 Error 1005 Can't create table 't1' (use SHOW WARNINGS for more info).
924 CREATE TABLE t1 (a INT PRIMARY KEY, b TEXT)
925 ENGINE=ndb;
926 show warnings;
927 Level Code Message
928 drop table t1;
929 select node_id, remote_node_id, type
930 from ndbinfo.transporter_details
931 order by node_id, remote_node_id;
932 node_id remote_node_id type
933 1 2 TCP
934 1 2 TCP
935 1 2 TCP
936 1 2 TCP
937 1 3 TCP
938 1 3 TCP
939 1 3 TCP
940 1 3 TCP
941 1 4 TCP
942 1 16 TCP
943 1 32 TCP
944 1 48 TCP
945 1 49 TCP
946 1 63 TCP
947 1 127 TCP
948 1 192 TCP
949 1 228 TCP
950 1 229 TCP
951 1 230 TCP
952 1 231 TCP
953 1 232 TCP
954 1 233 TCP
955 1 255 TCP
956 2 1 TCP
957 2 1 TCP
958 2 1 TCP
959 2 1 TCP
960 2 3 TCP
961 2 3 TCP
962 2 3 TCP
963 2 3 TCP
964 2 4 TCP
965 2 16 TCP
966 2 32 TCP
967 2 48 TCP
968 2 49 TCP
969 2 63 TCP
970 2 127 TCP
971 2 192 TCP
972 2 228 TCP
973 2 229 TCP
974 2 230 TCP
975 2 231 TCP
976 2 232 TCP
977 2 233 TCP
978 2 255 TCP
979 3 1 TCP
980 3 1 TCP
981 3 1 TCP
982 3 1 TCP
983 3 2 TCP
984 3 2 TCP
985 3 2 TCP
986 3 2 TCP
987 3 4 TCP
988 3 16 TCP
989 3 32 TCP
990 3 48 TCP
991 3 49 TCP
992 3 63 TCP
993 3 127 TCP
994 3 192 TCP
995 3 228 TCP
996 3 229 TCP
997 3 230 TCP
998 3 231 TCP
999 3 232 TCP
1000 3 233 TCP
1001 3 255 TCP