~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/union.result

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
PRIMARY KEY  (cid),
233
233
KEY cap (cap)
234
234
) ;
235
 
Warnings:
236
 
Warning 1071    Specified key was too long; max key length is 767 bytes
237
235
CREATE TABLE t3 (
238
236
gid int NOT NULL auto_increment,
239
237
gn varchar(255) NOT NULL default '',
241
239
PRIMARY KEY  (gid),
242
240
KEY gn (gn)
243
241
) ;
244
 
Warnings:
245
 
Warning 1071    Specified key was too long; max key length is 767 bytes
246
242
INSERT INTO t3 VALUES (1,'V1',NULL);
247
243
CREATE TABLE t4 (
248
244
uid bigint NOT NULL default '0',
262
258
PRIMARY KEY  (rid),
263
259
KEY rl (rl)
264
260
) ;
265
 
Warnings:
266
 
Warning 1071    Specified key was too long; max key length is 767 bytes
267
261
CREATE TABLE t6 (
268
262
uid bigint NOT NULL auto_increment,
269
263
un varchar(190) NOT NULL default '',
511
505
explain (select * from t1 where a=1) union (select * from t1 where b=1);
512
506
id      select_type     table   type    possible_keys   key     key_len ref     rows    Extra
513
507
1       PRIMARY t1      const   PRIMARY PRIMARY 4       const   1       
514
 
2       UNION   t1      ref     b       b       5       const   1       Using index
 
508
2       UNION   t1      ref     b       b       5       const   1       Using where; Using index
515
509
NULL    UNION RESULT    <union1,2>      ALL     NULL    NULL    NULL    NULL    NULL    
516
510
drop table t1,t2;
517
511
create table t1 (   id int not null auto_increment, primary key (id)   ,user_name text );
521
515
insert into t2 (group_name) values ('Group A');
522
516
insert into t2 (group_name) values ('Group B');
523
517
insert into t3 (user_id, group_id) values (1,1);
524
 
select 1 'is_in_group', a.user_name, c.group_name, b.id from t1 a, t3 b, t2 c where a.id = b.user_id and b.group_id = c.id UNION  select 0 'is_in_group', a.user_name, c.group_name, null from t1 a, t2 c;
 
518
select 1 'is_in_group', a.user_name, c.group_name, b.id from t1 a, t3 b, t2 c where a.id = b.user_id and b.group_id = c.id UNION  select 0 'is_in_group', a.user_name, c.group_name, null from t1 a CROSS JOIN t2 c;
525
519
is_in_group     user_name       group_name      id
526
520
1       Tester  Group A 1
527
521
0       Tester  Group A NULL
545
539
select * from t1;
546
540
a
547
541
a
 
542
aa
548
543
show create table t1;
549
544
Table   Create Table
550
545
t1      CREATE TABLE `t1` (
551
 
  `a` varchar(1) NOT NULL DEFAULT ''
552
 
) ENGINE=DEFAULT
 
546
  `a` VARCHAR(2) COLLATE utf8_general_ci NOT NULL DEFAULT ''
 
547
) ENGINE=DEFAULT COLLATE = utf8_general_ci
553
548
drop table t1;
554
549
create table t1 SELECT 12 as a UNION select "aa" as a;
555
550
select * from t1;
559
554
show create table t1;
560
555
Table   Create Table
561
556
t1      CREATE TABLE `t1` (
562
 
  `a` varbinary(4) NOT NULL DEFAULT ''
563
 
) ENGINE=DEFAULT
 
557
  `a` VARBINARY(8) NOT NULL DEFAULT ''
 
558
) ENGINE=DEFAULT COLLATE = utf8_general_ci
564
559
drop table t1;
565
560
create table t1 SELECT 12 as a UNION select 12.2 as a;
566
561
select * from t1;
570
565
show create table t1;
571
566
Table   Create Table
572
567
t1      CREATE TABLE `t1` (
573
 
  `a` decimal(3,1) NOT NULL DEFAULT '0.0'
574
 
) ENGINE=DEFAULT
 
568
  `a` DECIMAL(3,1) NOT NULL DEFAULT '0.0'
 
569
) ENGINE=DEFAULT COLLATE = utf8_general_ci
575
570
drop table t1;
576
571
create table t2 (it1 int, it2 int not null, i int not null, ib int, f float, d double, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
577
572
insert into t2 values (NULL, 1, 3, 4, 1.5, 2.5, '1972-10-22', '1972-10-22 11:50:00', 'testc', 'testv', 'tetetetetest', 'teeeeeeeeeeeest');
583
578
show create table t1;
584
579
Table   Create Table
585
580
t1      CREATE TABLE `t1` (
586
 
  `it2` int DEFAULT NULL
587
 
) ENGINE=DEFAULT
 
581
  `it2` INT DEFAULT NULL
 
582
) ENGINE=DEFAULT COLLATE = utf8_general_ci
588
583
drop table t1;
589
584
create table t1 SELECT it2 from t2 UNION select i from t2;
590
585
select * from t1;
594
589
show create table t1;
595
590
Table   Create Table
596
591
t1      CREATE TABLE `t1` (
597
 
  `it2` int NOT NULL DEFAULT '0'
598
 
) ENGINE=DEFAULT
 
592
  `it2` INT NOT NULL DEFAULT '0'
 
593
) ENGINE=DEFAULT COLLATE = utf8_general_ci
599
594
drop table t1;
600
595
create table t1 SELECT i from t2 UNION select f from t2;
601
596
select * from t1;
605
600
show create table t1;
606
601
Table   Create Table
607
602
t1      CREATE TABLE `t1` (
608
 
  `i` double DEFAULT NULL
609
 
) ENGINE=DEFAULT
 
603
  `i` DOUBLE DEFAULT NULL
 
604
) ENGINE=DEFAULT COLLATE = utf8_general_ci
610
605
drop table t1;
611
606
create table t1 SELECT f from t2 UNION select d from t2;
612
607
select * from t1;
616
611
show create table t1;
617
612
Table   Create Table
618
613
t1      CREATE TABLE `t1` (
619
 
  `f` double DEFAULT NULL
620
 
) ENGINE=DEFAULT
 
614
  `f` DOUBLE DEFAULT NULL
 
615
) ENGINE=DEFAULT COLLATE = utf8_general_ci
621
616
drop table t1;
622
617
create table t1 SELECT ib from t2 UNION select f from t2;
623
618
select * from t1;
627
622
show create table t1;
628
623
Table   Create Table
629
624
t1      CREATE TABLE `t1` (
630
 
  `ib` double DEFAULT NULL
631
 
) ENGINE=DEFAULT
 
625
  `ib` DOUBLE DEFAULT NULL
 
626
) ENGINE=DEFAULT COLLATE = utf8_general_ci
632
627
drop table t1;
633
628
create table t1 SELECT ib from t2 UNION select d from t2;
634
629
select * from t1;
638
633
show create table t1;
639
634
Table   Create Table
640
635
t1      CREATE TABLE `t1` (
641
 
  `ib` double DEFAULT NULL
642
 
) ENGINE=DEFAULT
 
636
  `ib` DOUBLE DEFAULT NULL
 
637
) ENGINE=DEFAULT COLLATE = utf8_general_ci
643
638
drop table t1;
644
639
create table t1 SELECT f from t2 UNION select da from t2;
645
640
select * from t1;
649
644
show create table t1;
650
645
Table   Create Table
651
646
t1      CREATE TABLE `t1` (
652
 
  `f` varbinary(22) DEFAULT NULL
653
 
) ENGINE=DEFAULT
 
647
  `f` VARBINARY(22) DEFAULT NULL
 
648
) ENGINE=DEFAULT COLLATE = utf8_general_ci
654
649
drop table t1;
655
650
create table t1 SELECT da from t2 UNION select dt from t2;
656
651
select * from t1;
660
655
show create table t1;
661
656
Table   Create Table
662
657
t1      CREATE TABLE `t1` (
663
 
  `da` datetime DEFAULT NULL
664
 
) ENGINE=DEFAULT
 
658
  `da` DATETIME DEFAULT NULL
 
659
) ENGINE=DEFAULT COLLATE = utf8_general_ci
665
660
drop table t1;
666
661
create table t1 SELECT dt from t2 UNION select trim(sc) from t2;
667
662
select trim(dt) from t1;
671
666
show create table t1;
672
667
Table   Create Table
673
668
t1      CREATE TABLE `t1` (
674
 
  `dt` varbinary(19) DEFAULT NULL
675
 
) ENGINE=DEFAULT
 
669
  `dt` VARBINARY(40) DEFAULT NULL
 
670
) ENGINE=DEFAULT COLLATE = utf8_general_ci
676
671
drop table t1;
677
672
create table t1 SELECT dt from t2 UNION select sv from t2;
678
673
select * from t1;
682
677
show create table t1;
683
678
Table   Create Table
684
679
t1      CREATE TABLE `t1` (
685
 
  `dt` varbinary(40) DEFAULT NULL
686
 
) ENGINE=DEFAULT
 
680
  `dt` VARBINARY(40) DEFAULT NULL
 
681
) ENGINE=DEFAULT COLLATE = utf8_general_ci
687
682
drop table t1;
688
683
create table t1 SELECT sc from t2 UNION select sv from t2;
689
684
select * from t1;
693
688
show create table t1;
694
689
Table   Create Table
695
690
t1      CREATE TABLE `t1` (
696
 
  `sc` varchar(10) DEFAULT NULL
697
 
) ENGINE=DEFAULT
 
691
  `sc` VARCHAR(10) COLLATE utf8_general_ci DEFAULT NULL
 
692
) ENGINE=DEFAULT COLLATE = utf8_general_ci
698
693
drop table t1;
699
694
create table t1 SELECT dt from t2 UNION select b from t2;
700
695
select * from t1;
704
699
show create table t1;
705
700
Table   Create Table
706
701
t1      CREATE TABLE `t1` (
707
 
  `dt` blob
708
 
) ENGINE=DEFAULT
 
702
  `dt` BLOB
 
703
) ENGINE=DEFAULT COLLATE = utf8_general_ci
709
704
drop table t1;
710
705
create table t1 SELECT sv from t2 UNION select b from t2;
711
706
select * from t1;
715
710
show create table t1;
716
711
Table   Create Table
717
712
t1      CREATE TABLE `t1` (
718
 
  `sv` blob
719
 
) ENGINE=DEFAULT
 
713
  `sv` BLOB
 
714
) ENGINE=DEFAULT COLLATE = utf8_general_ci
720
715
drop table t1;
721
716
create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2;
722
717
select * from t1;
727
722
show create table t1;
728
723
Table   Create Table
729
724
t1      CREATE TABLE `t1` (
730
 
  `i` blob
731
 
) ENGINE=DEFAULT
 
725
  `i` BLOB
 
726
) ENGINE=DEFAULT COLLATE = utf8_general_ci
732
727
drop table t1;
733
728
create table t1 SELECT sv from t2 UNION select tx from t2;
734
729
select * from t1;
738
733
show create table t1;
739
734
Table   Create Table
740
735
t1      CREATE TABLE `t1` (
741
 
  `sv` text
742
 
) ENGINE=DEFAULT
 
736
  `sv` TEXT COLLATE utf8_general_ci
 
737
) ENGINE=DEFAULT COLLATE = utf8_general_ci
743
738
drop table t1;
744
739
create table t1 SELECT b from t2 UNION select tx from t2;
745
740
select * from t1;
749
744
show create table t1;
750
745
Table   Create Table
751
746
t1      CREATE TABLE `t1` (
752
 
  `b` blob
753
 
) ENGINE=DEFAULT
 
747
  `b` BLOB
 
748
) ENGINE=DEFAULT COLLATE = utf8_general_ci
754
749
drop table t1,t2;
755
750
create table t1 select 1 union select -1;
756
751
select * from t1;
760
755
show create table t1;
761
756
Table   Create Table
762
757
t1      CREATE TABLE `t1` (
763
 
  `1` bigint NOT NULL DEFAULT '0'
764
 
) ENGINE=DEFAULT
 
758
  `1` BIGINT NOT NULL DEFAULT '0'
 
759
) ENGINE=DEFAULT COLLATE = utf8_general_ci
765
760
drop table t1;
766
761
create table t1 select _latin1"test" union select _latin1"testt" ;
767
762
ERROR 42S22: Unknown column '_latin1' in 'field list'
771
766
show create table t1;
772
767
Table   Create Table
773
768
t1      CREATE TABLE `t1` (
774
 
  `test` varchar(4) NOT NULL DEFAULT ''
775
 
) ENGINE=DEFAULT
 
769
  `test` VARCHAR(5) COLLATE utf8_general_ci NOT NULL DEFAULT ''
 
770
) ENGINE=DEFAULT COLLATE = utf8_general_ci
776
771
drop table t1;
777
772
create table t1 (s char(200));
778
773
insert into t1 values (repeat("1",200));
783
778
insert into t1 select * from t2;
784
779
insert into t2 select * from t1;
785
780
set local tmp_table_size=1024;
786
 
select count(*) from (select * from t1 union all select * from t2 order by 1) b;
 
781
select SQL_BIG_RESULT count(*) from (select SQL_BIG_RESULT * from t1 union all select * from t2 order by 1) b;
787
782
count(*)
788
783
21
789
784
select count(*) from t1;
1014
1009
show create table t1;
1015
1010
Table   Create Table
1016
1011
t1      CREATE TABLE `t1` (
1017
 
  `test` varchar(4) NOT NULL DEFAULT ''
1018
 
) ENGINE=DEFAULT
 
1012
  `test` VARCHAR(4) COLLATE utf8_general_ci NOT NULL DEFAULT ''
 
1013
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1019
1014
select count(*) from t1;
1020
1015
count(*)
1021
1016
1
1027
1022
show create table t1;
1028
1023
Table   Create Table
1029
1024
t1      CREATE TABLE `t1` (
1030
 
  `'test' collate utf8_bin` varchar(4) COLLATE utf8_bin DEFAULT NULL
1031
 
) ENGINE=DEFAULT
 
1025
  `'test' collate utf8_bin` VARCHAR(4) COLLATE utf8_bin DEFAULT NULL
 
1026
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1032
1027
select count(*) from t1;
1033
1028
count(*)
1034
1029
3
1040
1035
show create table t1;
1041
1036
Table   Create Table
1042
1037
t1      CREATE TABLE `t1` (
1043
 
  `test` varchar(4) COLLATE utf8_bin DEFAULT NULL
1044
 
) ENGINE=DEFAULT
 
1038
  `test` VARCHAR(4) COLLATE utf8_bin DEFAULT NULL
 
1039
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1045
1040
select count(*) from t1;
1046
1041
count(*)
1047
1042
3
1053
1048
show create table t1;
1054
1049
Table   Create Table
1055
1050
t1      CREATE TABLE `t1` (
1056
 
  `test` varchar(4) COLLATE utf8_bin DEFAULT NULL
1057
 
) ENGINE=DEFAULT
 
1051
  `test` VARCHAR(4) COLLATE utf8_bin DEFAULT NULL
 
1052
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1058
1053
select count(*) from t1;
1059
1054
count(*)
1060
1055
3
1081
1076
show create table t1;
1082
1077
Table   Create Table
1083
1078
t1      CREATE TABLE `t1` (
1084
 
  `a` varchar(1) COLLATE utf8_swedish_ci DEFAULT NULL
1085
 
) ENGINE=DEFAULT
 
1079
  `a` VARCHAR(1) COLLATE utf8_swedish_ci DEFAULT NULL
 
1080
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1086
1081
drop table t1;
1087
1082
create table t1 as
1088
1083
(select a from t2) union
1091
1086
show create table t1;
1092
1087
Table   Create Table
1093
1088
t1      CREATE TABLE `t1` (
1094
 
  `a` varchar(1) COLLATE utf8_spanish_ci DEFAULT NULL
1095
 
) ENGINE=DEFAULT
 
1089
  `a` VARCHAR(1) COLLATE utf8_spanish_ci DEFAULT NULL
 
1090
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1096
1091
drop table t1;
1097
1092
drop table t2;
1098
1093
create table t1(a1 int, f1 char(10));
1103
1098
order by f2, a1;
1104
1099
show columns from t2;
1105
1100
Field   Type    Null    Default Default_is_NULL On_Update
1106
 
f2      DATE    TRUE            TRUE    
1107
 
a1      INTEGER TRUE            TRUE    
 
1101
f2      DATE    YES             YES     
 
1102
a1      INTEGER YES             YES     
1108
1103
drop table t1, t2;
1109
1104
create table t1 (f1 int);
1110
1105
create table t2 (f1 int, f2 int ,f3 date);
1129
1124
order by sdate;
1130
1125
show columns from t4;
1131
1126
Field   Type    Null    Default Default_is_NULL On_Update
1132
 
sdate   DATE    TRUE            TRUE    
 
1127
sdate   DATE    YES             YES     
1133
1128
drop table t1, t2, t3, t4;
1134
1129
create table t1 (a int not null, b char (10) not null);
1135
1130
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
1161
1156
select concat('a', 'b' collate utf8_bin);
1162
1157
concat('a', 'b' collate utf8_bin)
1163
1158
ab
1164
 
create table t1 (foo varchar(100)) collate utf8_bin;
 
1159
create table t1 (foo varchar(100)) collate=utf8_bin;
1165
1160
insert into t1 (foo) values ("foo");
1166
1161
select foo from t1 union select 'bar' as foo from dual;
1167
 
ERROR 42S02: Table 'test.dual' doesn't exist
 
1162
ERROR 42S02: Unknown table 'test.dual'
1168
1163
select foo from t1 union select 'bar' as foo;
1169
1164
foo
1170
1165
foo
1201
1196
show create table t2;
1202
1197
Table   Create Table
1203
1198
t2      CREATE TABLE `t2` (
1204
 
  `a` varchar(5) DEFAULT NULL
1205
 
) ENGINE=DEFAULT
 
1199
  `a` VARCHAR(12) COLLATE utf8_general_ci DEFAULT NULL
 
1200
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1206
1201
select row_format from data_dictionary.TABLES where table_schema="test" and table_name="t2";
1207
1202
row_format
1208
1203
DEFAULT
1209
1204
show create table t2;
1210
1205
Table   Create Table
1211
1206
t2      CREATE TABLE `t2` (
1212
 
  `a` varchar(5) DEFAULT NULL
1213
 
) ENGINE=DEFAULT
 
1207
  `a` VARCHAR(12) COLLATE utf8_general_ci DEFAULT NULL
 
1208
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1214
1209
drop table t1,t2;
1215
1210
CREATE TABLE t1 (a mediumtext);
1216
1211
CREATE TABLE t2 (b varchar(20));
1223
1218
show create table t3;
1224
1219
Table   Create Table
1225
1220
t3      CREATE TABLE `t3` (
1226
 
  `left(a,100000000)` text
1227
 
) ENGINE=DEFAULT
 
1221
  `left(a,100000000)` TEXT COLLATE utf8_general_ci
 
1222
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1228
1223
drop tables t1,t2,t3;
1229
1224
CREATE TABLE t1 (a longtext);
1230
1225
CREATE TABLE t2 (b varchar(20));
1237
1232
show create table t3;
1238
1233
Table   Create Table
1239
1234
t3      CREATE TABLE `t3` (
1240
 
  `left(a,100000000)` text
1241
 
) ENGINE=DEFAULT
 
1235
  `left(a,100000000)` TEXT COLLATE utf8_general_ci
 
1236
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1242
1237
drop tables t1,t2,t3;
1243
1238
SELECT @tmp_max:= @@max_allowed_packet;
1244
1239
@tmp_max:= @@max_allowed_packet
1245
 
1048576
 
1240
67108864
1246
1241
SET max_allowed_packet=25000000;
1247
1242
CREATE TABLE t1 (a mediumtext);
1248
1243
CREATE TABLE t2 (b varchar(20));
1251
1246
SHOW CREATE TABLE t3;
1252
1247
Table   Create Table
1253
1248
t3      CREATE TABLE `t3` (
1254
 
  `a` text
1255
 
) ENGINE=DEFAULT
 
1249
  `a` TEXT COLLATE utf8_general_ci
 
1250
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1256
1251
DROP TABLES t1,t3;
1257
1252
CREATE TABLE t1 (a tinytext);
1258
1253
INSERT INTO t1 VALUES ('a');
1260
1255
SHOW CREATE TABLE t3;
1261
1256
Table   Create Table
1262
1257
t3      CREATE TABLE `t3` (
1263
 
  `a` text
1264
 
) ENGINE=DEFAULT
 
1258
  `a` TEXT COLLATE utf8_general_ci
 
1259
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1265
1260
DROP TABLES t1,t3;
1266
1261
CREATE TABLE t1 (a mediumtext);
1267
1262
INSERT INTO t1 VALUES ('a');
1269
1264
SHOW CREATE TABLE t3;
1270
1265
Table   Create Table
1271
1266
t3      CREATE TABLE `t3` (
1272
 
  `a` text
1273
 
) ENGINE=DEFAULT
 
1267
  `a` TEXT COLLATE utf8_general_ci
 
1268
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1274
1269
DROP TABLES t1,t3;
1275
1270
CREATE TABLE t1 (a tinyblob);
1276
1271
INSERT INTO t1 VALUES ('a');
1278
1273
SHOW CREATE TABLE t3;
1279
1274
Table   Create Table
1280
1275
t3      CREATE TABLE `t3` (
1281
 
  `a` blob
1282
 
) ENGINE=DEFAULT
 
1276
  `a` BLOB
 
1277
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1283
1278
DROP TABLES t1,t2,t3;
1284
1279
SET max_allowed_packet:= @tmp_max;
1285
1280
create table t1 ( id int not null auto_increment, primary key (id), col1 int);
1306
1301
show create table t2;
1307
1302
Table   Create Table
1308
1303
t2      CREATE TABLE `t2` (
1309
 
  `f1` varchar(1) DEFAULT NULL,
1310
 
  `f2` varchar(5) DEFAULT NULL,
1311
 
  `f3` blob,
1312
 
  `f4` blob,
1313
 
  `f5` timestamp NULL DEFAULT NULL,
1314
 
  `f6` varchar(1) DEFAULT NULL,
1315
 
  `f7` text,
1316
 
  `f8` text
1317
 
) ENGINE=DEFAULT
 
1304
  `f1` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL,
 
1305
  `f2` VARCHAR(5) COLLATE utf8_general_ci DEFAULT NULL,
 
1306
  `f3` BLOB,
 
1307
  `f4` BLOB,
 
1308
  `f5` TIMESTAMP NULL DEFAULT NULL,
 
1309
  `f6` VARCHAR(1) COLLATE utf8_general_ci DEFAULT NULL,
 
1310
  `f7` TEXT COLLATE utf8_general_ci,
 
1311
  `f8` TEXT COLLATE utf8_general_ci
 
1312
) ENGINE=DEFAULT COLLATE = utf8_general_ci
1318
1313
drop table t1, t2;
1319
1314
(select avg(1)) union (select avg(1)) union (select avg(1)) union
1320
1315
(select avg(1)) union (select avg(1)) union (select avg(1)) union
1364
1359
select '12' union select '12345';
1365
1360
12
1366
1361
12
 
1362
12345
1367
1363
CREATE TABLE t1 (a int);
1368
1364
INSERT INTO t1 VALUES (3),(1),(2),(4),(1);
1369
1365
SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a) AS test;
1439
1435
CREATE TABLE t2 SELECT * FROM (SELECT NULL) a UNION SELECT a FROM t1;
1440
1436
DESC t2;
1441
1437
Field   Type    Null    Default Default_is_NULL On_Update
1442
 
NULL    INTEGER TRUE            TRUE    
 
1438
NULL    INTEGER YES             YES     
1443
1439
CREATE TABLE t3 SELECT a FROM t1 UNION SELECT * FROM (SELECT NULL) a;
1444
1440
DESC t3;
1445
1441
Field   Type    Null    Default Default_is_NULL On_Update
1446
 
a       INTEGER TRUE            TRUE    
 
1442
a       INTEGER YES             YES     
1447
1443
CREATE TABLE t4 SELECT NULL;
1448
1444
DESC t4;
1449
1445
Field   Type    Null    Default Default_is_NULL On_Update
1450
 
NULL    VARCHAR TRUE            TRUE    
 
1446
NULL    VARBINARY       YES             YES     
1451
1447
CREATE TABLE t5 SELECT NULL UNION SELECT NULL;
1452
1448
DESC t5;
1453
1449
Field   Type    Null    Default Default_is_NULL On_Update
1454
 
NULL    VARCHAR TRUE            TRUE    
 
1450
NULL    VARBINARY       YES             YES     
1455
1451
CREATE TABLE t6 
1456
1452
SELECT * FROM (SELECT * FROM (SELECT NULL)a) b UNION SELECT a FROM t1;
1457
1453
DESC t6;
1458
1454
Field   Type    Null    Default Default_is_NULL On_Update
1459
 
NULL    INTEGER TRUE            TRUE    
 
1455
NULL    INTEGER YES             YES     
1460
1456
DROP TABLE t1, t2, t3, t4, t5, t6;
1461
1457
End of 5.0 tests