~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to tests/r/union.result

  • Committer: Padraig O'Sullivan
  • Date: 2010-03-15 14:05:26 UTC
  • mfrom: (1237.9.99 staging)
  • Revision ID: osullivan.padraig@gmail.com-20100315140526-opbgwdwn6tfecdkq
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
804
804
FLUSH STATUS;
805
805
show status like 'Slow_queries';
806
806
Variable_name   Value
807
 
Slow_queries    0
 
807
Slow_queries    #
808
808
select count(*) from t1 where a=7;
809
809
count(*)
810
810
26
811
811
show status like 'Slow_queries';
812
812
Variable_name   Value
813
 
Slow_queries    0
 
813
Slow_queries    #
814
814
select count(*) from t1 where b=13;
815
815
count(*)
816
816
10
817
817
show status like 'Slow_queries';
818
818
Variable_name   Value
819
 
Slow_queries    0
 
819
Slow_queries    #
820
820
select count(*) from t1 where b=13 union select count(*) from t1 where a=7;
821
821
count(*)
822
822
10
823
823
26
824
824
show status like 'Slow_queries';
825
825
Variable_name   Value
826
 
Slow_queries    0
 
826
Slow_queries    #
827
827
select count(*) from t1 where a=7 union select count(*) from t1 where b=13;
828
828
count(*)
829
829
26
830
830
10
831
831
show status like 'Slow_queries';
832
832
Variable_name   Value
833
 
Slow_queries    0
 
833
Slow_queries    #
834
834
flush status;
835
835
select a from t1 where b not in (1,2,3) union select a from t1 where b not in (4,5,6);
836
836
a
846
846
2
847
847
show status like 'Slow_queries';
848
848
Variable_name   Value
849
 
Slow_queries    0
 
849
Slow_queries    #
850
850
drop table t1;
851
851
create table t1 (   RID int not null default '0',   IID int not null default '0',    nada varchar(50)  not null,NAME varchar(50) not null,PHONE varchar(50) not null);
852
852
insert into t1 ( RID,IID,nada,NAME,PHONE) values (1, 1, 'main', 'a', '111'), (2, 1, 'main', 'b', '222'), (3, 1, 'main', 'c', '333'), (4, 1, 'main', 'd', '444'), (5, 1, 'main', 'e', '555'), (6, 2, 'main', 'c', '333'), (7, 2, 'main', 'd', '454'), (8, 2, 'main', 'e', '555'), (9, 2, 'main', 'f', '666'), (10, 2, 'main', 'g', '777');
1102
1102
select f2,a1 from (select a1, CAST('2004-12-31' AS DATE) f2 from t1) a
1103
1103
order by f2, a1;
1104
1104
show columns from t2;
1105
 
Field   Type    Null    Key     Default Extra
1106
 
f2      date    YES             NULL    
1107
 
a1      int     YES             NULL    
 
1105
Field   Type    Null    Default Default_is_NULL On_Update
 
1106
f2      DATE    TRUE            TRUE    
 
1107
a1      INTEGER TRUE            TRUE    
1108
1108
drop table t1, t2;
1109
1109
create table t1 (f1 int);
1110
1110
create table t2 (f1 int, f2 int ,f3 date);
1128
1128
)
1129
1129
order by sdate;
1130
1130
show columns from t4;
1131
 
Field   Type    Null    Key     Default Extra
1132
 
sdate   date    YES             NULL    
 
1131
Field   Type    Null    Default Default_is_NULL On_Update
 
1132
sdate   DATE    TRUE            TRUE    
1133
1133
drop table t1, t2, t3, t4;
1134
1134
create table t1 (a int not null, b char (10) not null);
1135
1135
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
1438
1438
INSERT INTO t1 VALUES (1), (2), (3);
1439
1439
CREATE TABLE t2 SELECT * FROM (SELECT NULL) a UNION SELECT a FROM t1;
1440
1440
DESC t2;
1441
 
Field   Type    Null    Key     Default Extra
1442
 
NULL    int     YES             NULL    
 
1441
Field   Type    Null    Default Default_is_NULL On_Update
 
1442
NULL    INTEGER TRUE            TRUE    
1443
1443
CREATE TABLE t3 SELECT a FROM t1 UNION SELECT * FROM (SELECT NULL) a;
1444
1444
DESC t3;
1445
 
Field   Type    Null    Key     Default Extra
1446
 
a       int     YES             NULL    
 
1445
Field   Type    Null    Default Default_is_NULL On_Update
 
1446
a       INTEGER TRUE            TRUE    
1447
1447
CREATE TABLE t4 SELECT NULL;
1448
1448
DESC t4;
1449
 
Field   Type    Null    Key     Default Extra
1450
 
NULL    varbinary(0)    YES             NULL    
 
1449
Field   Type    Null    Default Default_is_NULL On_Update
 
1450
NULL    VARCHAR TRUE            TRUE    
1451
1451
CREATE TABLE t5 SELECT NULL UNION SELECT NULL;
1452
1452
DESC t5;
1453
 
Field   Type    Null    Key     Default Extra
1454
 
NULL    varbinary(0)    YES             NULL    
 
1453
Field   Type    Null    Default Default_is_NULL On_Update
 
1454
NULL    VARCHAR TRUE            TRUE    
1455
1455
CREATE TABLE t6 
1456
1456
SELECT * FROM (SELECT * FROM (SELECT NULL)a) b UNION SELECT a FROM t1;
1457
1457
DESC t6;
1458
 
Field   Type    Null    Key     Default Extra
1459
 
NULL    int     YES             NULL    
 
1458
Field   Type    Null    Default Default_is_NULL On_Update
 
1459
NULL    INTEGER TRUE            TRUE    
1460
1460
DROP TABLE t1, t2, t3, t4, t5, t6;
1461
1461
End of 5.0 tests