summaryrefslogtreecommitdiff
path: root/mysql-test/suite/ndb/r/ndb_basic.result
blob: 9f4f8c0755cbf7a7e91903c512999ce3eaf0042e (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
DROP TABLE IF EXISTS t1,t2,t3,t4,t5,t6,t7;
drop database if exists mysqltest;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
drop table t1;
SHOW GLOBAL STATUS LIKE 'ndb%';
Variable_name	Value
Ndb_cluster_node_id	#
Ndb_config_from_host	#
Ndb_config_from_port	#
Ndb_number_of_data_nodes	#
SHOW GLOBAL VARIABLES LIKE 'ndb%';
Variable_name	Value
ndb_autoincrement_prefetch_sz	#
ndb_cache_check_time	#
ndb_connectstring	#
ndb_extra_logging	#
ndb_force_send	#
ndb_index_stat_cache_entries	#
ndb_index_stat_enable	#
ndb_index_stat_update_freq	#
ndb_report_thresh_binlog_epoch_slip	#
ndb_report_thresh_binlog_mem_usage	#
ndb_use_copying_alter_table	#
ndb_use_exact_count	#
ndb_use_transactions	#
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
SHOW INDEX FROM t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
t1	0	PRIMARY	1	pk1	A	0	NULL	NULL		BTREE	
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
SHOW INDEX FROM t1;
Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
t1	0	PRIMARY	1	pk1	A	2	NULL	NULL		BTREE	
SELECT pk1 FROM t1 ORDER BY pk1;
pk1
9410
9411
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
9410	9412	NULL	9412
9411	9413	17	9413
SELECT t1.* FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
9410	9412	NULL	9412
9411	9413	17	9413
UPDATE t1 SET attr1=1 WHERE pk1=9410;
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
9410	1	NULL	9412
9411	9413	17	9413
UPDATE t1 SET pk1=2 WHERE attr1=1;
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
2	1	NULL	9412
9411	9413	17	9413
UPDATE t1 SET pk1=pk1 + 1;
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
3	1	NULL	9412
9412	9413	17	9413
UPDATE t1 SET pk1=4 WHERE pk1 = 3;
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
4	1	NULL	9412
9412	9413	17	9413
DELETE FROM t1;
SELECT * FROM t1;
pk1	attr1	attr2	attr3
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9408, 8765, NULL, '8765'),
(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);
UPDATE t1 SET attr1 = 9999;
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
7	9999	NULL	NULL
8	9999	NULL	NULL
9	9999	NULL	NULL
10	9999	NULL	NULL
11	9999	NULL	NULL
12	9999	NULL	NULL
13	9999	NULL	NULL
9408	9999	NULL	8765
9410	9999	NULL	9412
UPDATE t1 SET attr1 = 9998 WHERE pk1 < 1000;
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
7	9998	NULL	NULL
8	9998	NULL	NULL
9	9998	NULL	NULL
10	9998	NULL	NULL
11	9998	NULL	NULL
12	9998	NULL	NULL
13	9998	NULL	NULL
9408	9999	NULL	8765
9410	9999	NULL	9412
UPDATE t1 SET attr1 = 9997 WHERE attr1 = 9999;
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
7	9998	NULL	NULL
8	9998	NULL	NULL
9	9998	NULL	NULL
10	9998	NULL	NULL
11	9998	NULL	NULL
12	9998	NULL	NULL
13	9998	NULL	NULL
9408	9997	NULL	8765
9410	9997	NULL	9412
DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1 ORDER BY pk1;
pk1	attr1	attr2	attr3
7	9998	NULL	NULL
8	9998	NULL	NULL
9	9998	NULL	NULL
10	9998	NULL	NULL
11	9998	NULL	NULL
12	9998	NULL	NULL
13	9998	NULL	NULL
9408	9997	NULL	8765
DELETE FROM t1;
SELECT * FROM t1;
pk1	attr1	attr2	attr3
INSERT INTO t1 values (1, 4, NULL, NULL), (2, 4, NULL, NULL), (3, 5, NULL, NULL), (4, 4, NULL, NULL), (5, 5, NULL, NULL);
DELETE FROM t1 WHERE attr1=4;
SELECT * FROM t1 order by pk1;
pk1	attr1	attr2	attr3
3	5	NULL	NULL
5	5	NULL	NULL
DELETE FROM t1;
INSERT INTO t1 VALUES (9410,9412, NULL, NULL), (9411, 9413, NULL, NULL);
DELETE FROM t1 WHERE pk1 = 9410;
SELECT * FROM t1;
pk1	attr1	attr2	attr3
9411	9413	NULL	NULL
DROP TABLE t1;
CREATE TABLE t1 (id INT, id2 int) engine=ndbcluster;
INSERT INTO t1 values(3456, 7890);
SELECT * FROM t1;
id	id2
3456	7890
UPDATE t1 SET id=2 WHERE id2=12;
SELECT * FROM t1;
id	id2
3456	7890
UPDATE t1 SET id=1234 WHERE id2=7890;
SELECT * FROM t1;
id	id2
1234	7890
DELETE FROM t1;
INSERT INTO t1 values(3456, 7890), (3456, 7890), (3456, 7890), (3454, 7890);
SELECT * FROM t1 ORDER BY id;
id	id2
3454	7890
3456	7890
3456	7890
3456	7890
DELETE FROM t1 WHERE id = 3456;
SELECT * FROM t1 ORDER BY id;
id	id2
3454	7890
DROP TABLE t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=NDBCLUSTER;
INSERT INTO t1 values(1, 9999);
DROP TABLE t1;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL
) ENGINE=NDB;
INSERT INTO t1 values(1, 9999);
DROP TABLE t1;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned
) engine=ndbcluster;
CREATE TABLE t3 (
a bigint unsigned NOT NULL,
b bigint unsigned not null,
c bigint unsigned,
PRIMARY KEY(a)
) engine=ndbcluster;
CREATE TABLE t4 (
a bigint unsigned NOT NULL,
b bigint unsigned not null,
c bigint unsigned NOT NULL,
d int unsigned,
PRIMARY KEY(a, b, c)
) engine=ndbcluster;
select * from t2 where a = 7 order by b;
a	b	c
7	16	5
select * from t2 where a = 7 order by a;
a	b	c
7	16	5
select * from t2 where a = 7 order by 2;
a	b	c
7	16	5
select * from t2 where a = 7 order by c;
a	b	c
7	16	5
select * from t2 where a = 7 and b = 16 order by b;
a	b	c
7	16	5
select * from t2 where a = 7 and b = 16 order by a;
a	b	c
7	16	5
select * from t2 where a = 7 and b = 17 order by a;
a	b	c
select * from t2 where a = 7 and b != 16 order by b;
a	b	c
select * from t2 where a = 7 and b = 16 and c = 5 order by b;
a	b	c
7	16	5
select * from t2 where a = 7 and b = 16 and c = 5 order by a;
a	b	c
7	16	5
select * from t2 where a = 7 and b = 16 and c = 6 order by a;
a	b	c
select * from t2 where a = 7 and b != 16 and c = 5 order by b;
a	b	c
select * from t3 where a = 7 order by b;
a	b	c
7	16	5
select * from t3 where a = 7 order by a;
a	b	c
7	16	5
select * from t3 where a = 7 order by 2;
a	b	c
7	16	5
select * from t3 where a = 7 order by c;
a	b	c
7	16	5
select * from t3 where a = 7 and b = 16 order by b;
a	b	c
7	16	5
select * from t3 where a = 7 and b = 16 order by a;
a	b	c
7	16	5
select * from t3 where a = 7 and b = 17 order by a;
a	b	c
select * from t3 where a = 7 and b != 16 order by b;
a	b	c
select * from t4 where a = 7 order by b;
a	b	c	d
7	16	5	26007
select * from t4 where a = 7 order by a;
a	b	c	d
7	16	5	26007
select * from t4 where a = 7 order by 2;
a	b	c	d
7	16	5	26007
select * from t4 where a = 7 order by c;
a	b	c	d
7	16	5	26007
select * from t4 where a = 7 and b = 16 order by b;
a	b	c	d
7	16	5	26007
select * from t4 where a = 7 and b = 16 order by a;
a	b	c	d
7	16	5	26007
select * from t4 where a = 7 and b = 17 order by a;
a	b	c	d
select * from t4 where a = 7 and b != 16 order by b;
a	b	c	d
delete from t2 where a > 5;
select x1.a, x1.b from t2 x1, t2 x2 where x1.b = x2.b order by x1.a;
a	b
1	10
3	12
5	14
select a, b FROM t2 outer_table where
a = (select a from t2 where b = outer_table.b ) order by a;
a	b
1	10
3	12
5	14
delete from t2;
delete from t3;
delete from t4;
drop table t2;
drop table t3;
drop table t4;
CREATE TABLE t5 (
a bigint unsigned NOT NULL,
b bigint unsigned not null,
c bigint unsigned NOT NULL,
d int unsigned,
PRIMARY KEY(a, b, c)
) engine=ndbcluster;
insert into t5 values(10, 19, 5, 26010);
delete from t5 where a=10 and b=19 and c=5;
select * from t5;
a	b	c	d
insert into t5 values(10, 19, 5, 26010);
update t5 set d=21997 where a=10 and b=19 and c=5;
select * from t5;
a	b	c	d
10	19	5	21997
delete from t5;
drop table t5;
CREATE TABLE t6 (
adress char(255),
a int NOT NULL PRIMARY KEY,
b int
) engine = NDB;
insert into t6 values
("Nice road 3456", 1, 23),
("Street Road 78", 3, 92),
("Road street 89C", 5, 71),
(NULL, 7, NULL);
select * from t6 order by a;
adress	a	b
Nice road 3456	1	23
Street Road 78	3	92
Road street 89C	5	71
NULL	7	NULL
select a, b from t6 order by a;
a	b
1	23
3	92
5	71
7	NULL
update t6 set adress="End of road 09" where a=3;
update t6 set b=181, adress="Street 76" where a=7;
select * from t6 order by a;
adress	a	b
Nice road 3456	1	23
End of road 09	3	92
Road street 89C	5	71
Street 76	7	181
select * from t6 where a=1;
adress	a	b
Nice road 3456	1	23
delete from t6 where a=1;
select * from t6 order by a;
adress	a	b
End of road 09	3	92
Road street 89C	5	71
Street 76	7	181
delete from t6 where b=71;
select * from t6 order by a;
adress	a	b
End of road 09	3	92
Street 76	7	181
drop table t6;
CREATE TABLE t7 (
adress char(255),
a int NOT NULL,
b int,
c int NOT NULL,
PRIMARY KEY(a, c)	
) engine = NDB;
insert into t7 values
("Highway 3456", 1, 23, 2),
("Street Road 78", 3, 92, 3),
("Main street 89C", 5, 71, 4),
(NULL, 8, NULL, 12);
select * from t7 order by a;
adress	a	b	c
Highway 3456	1	23	2
Street Road 78	3	92	3
Main street 89C	5	71	4
NULL	8	NULL	12
select a, b from t7 order by a;
a	b
1	23
3	92
5	71
8	NULL
update t7 set adress="End of road 09" where a=3;
update t7 set adress="Gatuvägen 90C" where a=5 and c=4;
update t7 set adress="No adress" where adress is NULL;
select * from t7 order by a;
adress	a	b	c
Highway 3456	1	23	2
End of road 09	3	92	3
Gatuvägen 90C	5	71	4
No adress	8	NULL	12
select * from t7 where a=1 and c=2;
adress	a	b	c
Highway 3456	1	23	2
delete from t7 where a=1;
delete from t7 where a=3 and c=3;
delete from t7 where a=5 and c=4;
select * from t7;
adress	a	b	c
No adress	8	NULL	12
delete from t7 where b=23;
select * from t7;
adress	a	b	c
No adress	8	NULL	12
drop table t7;
CREATE TABLE t1 (
pk1 INT NOT NULL PRIMARY KEY,
attr1 INT NOT NULL,
attr2 INT,
attr3 VARCHAR(10)
) ENGINE=ndbcluster;
INSERT INTO t1 VALUES (9410,9412, NULL, '9412'), (9411,9413, 17, '9413');
create database mysqltest;
use mysqltest;
CREATE TABLE t2 (
a bigint unsigned NOT NULL PRIMARY KEY,
b int unsigned not null,
c int unsigned
) engine=ndbcluster;
insert into t2 select pk1,attr1,attr2 from test.t1;
select * from t2 order by a;
a	b	c
9410	9412	NULL
9411	9413	17
select b from test.t1, t2 where c = test.t1.attr2;
b
9413
select b,test.t1.attr1 from test.t1, t2 where test.t1.pk1 < a;
b	attr1
9413	9412
drop table test.t1, t2;
drop database mysqltest;
drop database if exists ndbtest1;
create database ndbtest1;
use ndbtest1;
create table t1(id int) engine=ndbcluster;
drop database ndbtest1;
drop database ndbtest1;
ERROR HY000: Can't drop database 'ndbtest1'; database doesn't exist
use test;
create table t1 (a int primary key, b char(0));
insert into t1 values (1,"");
insert into t1 values (2,NULL);
select * from t1 order by a;
a	b
1	
2	NULL
select * from t1 order by b;
a	b
2	NULL
1	
select * from t1 where b IS NULL;
a	b
2	NULL
select * from t1 where b IS NOT NULL;
a	b
1	
drop table t1;
create table t1 (
c1 int,
c2 int,
c3 int,
c4 int,
c5 int,
c6 int,
c7 int,
c8 int,
c9 int,
c10 int,
c11 int,
c12 int,
c13 int,
c14 int,
c15 int,
c16 int,
c17 int,
c18 int,
c19 int,
c20 int,
c21 int,
c22 int,
c23 int,
c24 int,
c25 int,
c26 int,
c27 int,
c28 int,
c29 int,
c30 int,
c31 int,
c32 int,
c33 int,
c34 int,
c35 int,
c36 int,
c37 int,
c38 int,
c39 int,
c40 int,
c41 int,
c42 int,
c43 int,
c44 int,
c45 int,
c46 int,
c47 int,
c48 int,
c49 int,
c50 int,
c51 int,
c52 int,
c53 int,
c54 int,
c55 int,
c56 int,
c57 int,
c58 int,
c59 int,
c60 int,
c61 int,
c62 int,
c63 int,
c64 int,
c65 int,
c66 int,
c67 int,
c68 int,
c69 int,
c70 int,
c71 int,
c72 int,
c73 int,
c74 int,
c75 int,
c76 int,
c77 int,
c78 int,
c79 int,
c80 int,
c81 int,
c82 int,
c83 int,
c84 int,
c85 int,
c86 int,
c87 int,
c88 int,
c89 int,
c90 int,
c91 int,
c92 int,
c93 int,
c94 int,
c95 int,
c96 int,
c97 int,
c98 int,
c99 int,
c100 int,
c101 int,
c102 int,
c103 int,
c104 int,
c105 int,
c106 int,
c107 int,
c108 int,
c109 int,
c110 int,
c111 int,
c112 int,
c113 int,
c114 int,
c115 int,
c116 int,
c117 int,
c118 int,
c119 int,
c120 int,
c121 int,
c122 int,
c123 int,
c124 int,
c125 int,
c126 int,
c127 int,
c128 int,
primary key using hash(c1)) engine=ndb partition by key(c1);
drop table t1;
create table t1 (
a1234567890123456789012345678901234567890 int primary key,
a12345678901234567890123456789a1234567890 int,
index(a12345678901234567890123456789a1234567890)
) engine=ndb;
show tables;
Tables_in_test
t1
insert into t1 values (1,1),(2,1),(3,1),(4,1),(5,2),(6,1),(7,1);
explain select * from t1 where a12345678901234567890123456789a1234567890=2;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ref	a12345678901234567890123456789a1234567890	a12345678901234567890123456789a1234567890	5	const	#	Using where with pushed condition
select * from t1 where a12345678901234567890123456789a1234567890=2;
a1234567890123456789012345678901234567890	a12345678901234567890123456789a1234567890
5	2
drop table t1;
create table t1
(a bigint, b bigint, c bigint, d bigint, 
primary key (a,b,c,d)) 
engine=ndb
max_rows=800000000;
Warnings:
Warning	1105	Ndb might have problems storing the max amount of rows specified
insert into t1 values
(1,2,3,4),(2,3,4,5),(3,4,5,6),
(3,2,3,4),(1,3,4,5),(2,4,5,6),
(1,2,3,5),(2,3,4,8),(3,4,5,9),
(3,2,3,5),(1,3,4,8),(2,4,5,9),
(1,2,3,6),(2,3,4,6),(3,4,5,7),
(3,2,3,6),(1,3,4,6),(2,4,5,7),
(1,2,3,7),(2,3,4,7),(3,4,5,8),
(3,2,3,7),(1,3,4,7),(2,4,5,8),
(1,3,3,4),(2,4,4,5),(3,5,5,6),
(3,3,3,4),(1,4,4,5),(2,5,5,6),
(1,3,3,5),(2,4,4,8),(3,5,5,9),
(3,3,3,5),(1,4,4,8),(2,5,5,9),
(1,3,3,6),(2,4,4,6),(3,5,5,7),
(3,3,3,6),(1,4,4,6),(2,5,5,7),
(1,3,3,7),(2,4,4,7),(3,5,5,8),
(3,3,3,7),(1,4,4,7),(2,5,5,8);
select count(*) from t1;
count(*)
48
drop table t1;
create table t1
(a bigint, b bigint, c bigint, d bigint, 
primary key (a)) 
engine=ndb
max_rows=1;
drop table t1;
create table t1
(counter int(64) NOT NULL auto_increment,
datavalue char(40) default 'XXXX',
primary key (counter)
) ENGINE=ndbcluster;
insert into t1 (datavalue) values ('newval');
insert into t1 (datavalue) values ('newval');
select * from t1 order by counter;
counter	datavalue
1	newval
2	newval
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
select * from t1 order by counter;
counter	datavalue
1	newval
2	newval
3	newval
4	newval
5	newval
6	newval
7	newval
8	newval
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
insert into t1 (datavalue) select datavalue from t1 where counter < 100;
select * from t1 order by counter;
counter	datavalue
1	newval
2	newval
3	newval
4	newval
5	newval
6	newval
7	newval
8	newval
9	newval
10	newval
11	newval
12	newval
13	newval
14	newval
15	newval
16	newval
17	newval
18	newval
19	newval
20	newval
21	newval
22	newval
23	newval
24	newval
25	newval
26	newval
27	newval
28	newval
29	newval
30	newval
31	newval
32	newval
drop table t1;
create table t1 (a int primary key auto_increment) engine = ndb;
insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
insert into t1(a) values (20),(28);
insert into t1() values (),(),(),(),(),(),(),(),(),(),(),();
insert into t1() values (21), (22);
drop table t1;
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
select * from t1;
b
drop table t1;
create table t1 (a int) engine=ndb;
create table t2 (a int) engine=ndb;
insert into t1 values (1);
insert into t2 values (1);
delete t1.* from t1, t2 where t1.a = t2.a;
select * from t1;
a
select * from t2;
a
1
drop table t1;
drop table t2;
CREATE TABLE t1 (
i   INT,
j   INT,
x   INT,
y   INT,
z   INT
) engine=ndb;
CREATE TABLE t2 (
i   INT,
k   INT,
x   INT,
y   INT,
z   INT
) engine=ndb;
CREATE TABLE t3 (
j   INT,
k   INT,
x   INT,
y   INT,
z   INT
) engine=ndb;
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
UPDATE      t1 AS a
INNER JOIN  t2 AS b
ON a.i = b.i
INNER JOIN  t3 AS c
ON a.j = c.j  AND  b.k = c.k
SET         a.x = b.x,
a.y = b.y,
a.z = (
SELECT  sum(z)
FROM    t3
WHERE   y = 34
)
WHERE       b.x = 23;
select * from t1;
i	j	x	y	z
1	2	23	24	71
drop table t1;
drop table t2;
drop table t3;
create table atablewithareallylongandirritatingname (a int);
insert into atablewithareallylongandirritatingname values (2);
select * from atablewithareallylongandirritatingname;
a
2
drop table atablewithareallylongandirritatingname;
create table t1 (f1 varchar(50), f2 text,f3 int, primary key(f1)) engine=NDB;
insert into t1 (f1,f2,f3)VALUES("111111","aaaaaa",1);
insert into t1 (f1,f2,f3)VALUES("222222","bbbbbb",2);
select * from t1 order by f1;
f1	f2	f3
111111	aaaaaa	1
222222	bbbbbb	2
select * from t1 order by f2;
f1	f2	f3
111111	aaaaaa	1
222222	bbbbbb	2
select * from t1 order by f3;
f1	f2	f3
111111	aaaaaa	1
222222	bbbbbb	2
drop table t1;
Illegal ndb error code: 1186
CREATE TABLE t1 (
a VARBINARY(40) NOT NULL,
b VARCHAR (256) CHARACTER SET UTF8 NOT NULL,
c VARCHAR(256) CHARACTER SET UTF8 NOT NULL,
PRIMARY KEY (b,c))  ENGINE=ndbcluster;
INSERT INTO t1 VALUES
("a","ab","abc"),("b","abc","abcd"),("c","abc","ab"),("d","ab","ab"),("e","abc","abc");
SELECT * FROM t1 ORDER BY a;
a	b	c
a	ab	abc
b	abc	abcd
c	abc	ab
d	ab	ab
e	abc	abc
DROP TABLE t1;
create table t1 (a int not null primary key, b int not null) engine=ndb;
create table t2 (a int not null primary key, b int not null) engine=ndb;
insert into t1 values (1,10), (2,20), (3,30);
insert into t2 values (1,10), (2,20), (3,30);
select * from t1 order by a;
a	b
1	10
2	20
3	30
delete from t1 where a > 0 order by a desc limit 1;
select * from t1 order by a;
a	b
1	10
2	20
delete from t1,t2 using t1,t2 where t1.a = t2.a;
select * from t2 order by a;
a	b
3	30
drop table t1,t2;
create table t1 (a int not null primary key, b int not null) engine=ndb;
insert into t1 values (1,10), (2,20), (3,30);
insert into t1 set a=1, b=100;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
insert ignore into t1 set a=1, b=100;
select * from t1 order by a;
a	b
1	10
2	20
3	30
insert into t1 set a=1, b=1000 on duplicate key update b=b+1;
select * from t1 order by a;
a	b
1	11
2	20
3	30
drop table t1;
create table t1 (a int not null primary key, b int not null) engine=ndb;
create table t2 (c int not null primary key, d int not null) engine=ndb;
insert into t1 values (1,10), (2,10), (3,30), (4, 30);
insert into t2 values (1,10), (2,10), (3,30), (4, 30);
update t1 set a = 1 where a = 3;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1 order by a;
a	b
1	10
2	10
3	30
4	30
update t1 set b = 1 where a > 1 order by a desc limit 1;
select * from t1 order by a;
a	b
1	10
2	10
3	30
4	1
update t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t1 order by a;
a	b
1	10
2	10
3	30
4	1
update ignore t1,t2 set a = 1, c = 1 where a = 3 and c = 3;
select * from t1 order by a;
a	b
1	10
2	10
3	30
4	1
drop table t1,t2;
create table t1 (a varchar(100) primary key, b varchar(100)) engine = NDB;
insert into t1 values
('a', 'a'),('b','b'),('c', 'c'),('aa', 'aa'),('bb', 'bb'),('cc', 'cc');
replace into t1 values ('a', '-a');
replace into t1 values ('b', '-b');
replace into t1 values ('c', '-c');
replace into t1 values ('aa', '-aa');
replace into t1 values ('bb', '-bb');
replace into t1 values ('cc', '-cc');
replace into t1 values ('aaa', '-aaa');
replace into t1 values ('bbb', '-bbb');
replace into t1 values ('ccc', '-ccc');
select * from t1 order by 1,2;
a	b
a	-a
aa	-aa
aaa	-aaa
b	-b
bb	-bb
bbb	-bbb
c	-c
cc	-cc
ccc	-ccc
drop table t1;
End of 5.0 tests
CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
CREATE TABLE t2(a VARCHAR(255) NOT NULL,
b VARCHAR(255) NOT NULL,
c VARCHAR(255) NOT NULL,
CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
drop table t1, t2;
create table t1 (a int not null primary key, b int) engine=ndb;
insert into t1 values(1,1),(2,2),(3,3);
create table t2 like t1;
insert into t2 select * from t1;
select * from t1 order by a;
a	b
1	1
2	2
3	3
select * from t2 order by a;
a	b
1	1
2	2
3	3
drop table t1, t2;
create table t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
create table if not exists t1 (a int not null primary key, b int not null default 0, c varchar(254)) engine=ndb;
create table t2 like t1;
rename table t1 to t10, t2 to t20;
drop table t10,t20;
End of 5.1 tests