~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/union.test

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
CREATE TABLE t1 (
99
99
  `pseudo` char(35) NOT NULL default '',
100
100
  `pseudo1` char(35) NOT NULL default '',
101
 
  `same` tinyint(1) unsigned NOT NULL default '1',
 
101
  `same` int(1) NOT NULL default '1',
102
102
  PRIMARY KEY  (`pseudo1`),
103
103
  KEY `pseudo` (`pseudo`)
104
104
) ENGINE=MyISAM;
128
128
#
129
129
 
130
130
CREATE TABLE t1 (
131
 
  cid smallint(5) unsigned NOT NULL default '0',
 
131
  cid int(5) NOT NULL default '0',
132
132
  cv varchar(250) NOT NULL default '',
133
133
  PRIMARY KEY  (cid),
134
134
  UNIQUE KEY cv (cv)
135
135
) ;
136
136
INSERT INTO t1 VALUES (8,'dummy');
137
137
CREATE TABLE t2 (
138
 
  cid bigint(20) unsigned NOT NULL auto_increment,
 
138
  cid bigint(20) NOT NULL auto_increment,
139
139
  cap varchar(255) NOT NULL default '',
140
140
  PRIMARY KEY  (cid),
141
141
  KEY cap (cap)
142
142
) ;
143
143
CREATE TABLE t3 (
144
 
  gid bigint(20) unsigned NOT NULL auto_increment,
 
144
  gid bigint(20) NOT NULL auto_increment,
145
145
  gn varchar(255) NOT NULL default '',
146
 
  must tinyint(4) default NULL,
 
146
  must int(4) default NULL,
147
147
  PRIMARY KEY  (gid),
148
148
  KEY gn (gn)
149
149
) ;
150
150
INSERT INTO t3 VALUES (1,'V1',NULL);
151
151
CREATE TABLE t4 (
152
 
  uid bigint(20) unsigned NOT NULL default '0',
153
 
  gid bigint(20) unsigned default NULL,
154
 
  rid bigint(20) unsigned default NULL,
155
 
  cid bigint(20) unsigned default NULL,
 
152
  uid bigint(20) NOT NULL default '0',
 
153
  gid bigint(20) default NULL,
 
154
  rid bigint(20) default NULL,
 
155
  cid bigint(20) default NULL,
156
156
  UNIQUE KEY m (uid,gid,rid,cid),
157
157
  KEY uid (uid),
158
158
  KEY rid (rid),
161
161
) ;
162
162
INSERT INTO t4 VALUES (1,1,NULL,NULL);
163
163
CREATE TABLE t5 (
164
 
  rid bigint(20) unsigned NOT NULL auto_increment,
 
164
  rid bigint(20) NOT NULL auto_increment,
165
165
  rl varchar(255) NOT NULL default '',
166
166
  PRIMARY KEY  (rid),
167
167
  KEY rl (rl)
168
168
) ;
169
169
CREATE TABLE t6 (
170
 
  uid bigint(20) unsigned NOT NULL auto_increment,
 
170
  uid bigint(20) NOT NULL auto_increment,
171
171
  un varchar(250) NOT NULL default '',
172
 
  uc smallint(5) unsigned NOT NULL default '0',
 
172
  uc int(5) NOT NULL default '0',
173
173
  PRIMARY KEY  (uid),
174
174
  UNIQUE KEY nc (un,uc),
175
175
  KEY un (un)
276
276
#
277
277
# Test for another bug with UNION and LEFT JOIN
278
278
#
279
 
CREATE TABLE t1 (  id int(3) unsigned default '0') ENGINE=MyISAM;
 
279
CREATE TABLE t1 (  id int(3) default '0') ENGINE=MyISAM;
280
280
INSERT INTO t1 (id) VALUES("1");
281
 
CREATE TABLE t2 ( id int(3) unsigned default '0',  id_master int(5) default '0',  text1 varchar(5) default NULL,  text2 varchar(5) default NULL) ENGINE=MyISAM;
 
281
CREATE TABLE t2 ( id int(3) default '0',  id_master int(5) default '0',  text1 varchar(5) default NULL,  text2 varchar(5) default NULL) ENGINE=MyISAM;
282
282
INSERT INTO t2 (id, id_master, text1, text2) VALUES("1", "1",
283
283
"foo1", "bar1");
284
284
INSERT INTO t2 (id, id_master, text1, text2) VALUES("2", "1",
320
320
#
321
321
# fix_fields problem
322
322
#
323
 
create table t1 (mat_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT UNSIGNED NULL);
324
 
create table t2 (mat_id MEDIUMINT UNSIGNED NOT NULL, pla_id MEDIUMINT UNSIGNED NOT NULL);
 
323
create table t1 (mat_id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, matintnum CHAR(6) NOT NULL, test MEDIUMINT NULL);
 
324
create table t2 (mat_id MEDIUMINT NOT NULL, pla_id MEDIUMINT NOT NULL);
325
325
insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd', 4), (NULL, 'e', 5), (NULL, 'f', 6), (NULL, 'g', 7), (NULL, 'h', 8), (NULL, 'i', 9);
326
326
insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105);
327
327
SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id union SELECT 0, 0;
343
343
show create table t1;
344
344
drop table t1;
345
345
 
346
 
create table t2 (it1 tinyint, it2 tinyint not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
 
346
create table t2 (it1 int, it2 int not null, i int not null, ib bigint, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob, tx text);
347
347
insert into t2 values (NULL, 1, 3, 4, 1.5, 2.5, 1972, '1972-10-22', '1972-10-22 11:50', 'testc', 'testv', 'tetetetetest', 'teeeeeeeeeeeest');
348
348
 
349
349
create table t1 SELECT it2 from t2 UNION select it1 from t2;
488
488
# Bug #2809 (UNION fails on MyIsam tables when index on second column from
489
489
# same table)
490
490
#
491
 
create table t1 (col1 tinyint unsigned, col2 tinyint unsigned);
 
491
create table t1 (col1 int, col2 int);
492
492
insert into t1 values (1,2),(3,4),(5,6),(7,8),(9,10);
493
493
select col1 n from t1 union select col2 n from t1 order by n;
494
494
alter table t1 add index myindex (col2);
544
544
#
545
545
# parser stack overflow
546
546
#
547
 
CREATE TABLE t1 ( ID1 int(10) unsigned NOT NULL DEFAULT '0' , ID2 datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , DATA1 varchar(10) , DATA2 double(5,4) , DATA3 datetime , PRIMARY KEY (ID1,ID2));
 
547
CREATE TABLE t1 ( ID1 int(10) NOT NULL DEFAULT '0' , ID2 datetime NOT NULL DEFAULT '0000-00-00 00:00:00' , DATA1 varchar(10) , DATA2 double(5,4) , DATA3 datetime , PRIMARY KEY (ID1,ID2));
548
548
 
549
 
CREATE TABLE t2 ( ID int(3) unsigned NOT NULL DEFAULT '0' , DATA1 timestamp DEFAULT '0000-00-00 00:00:00' , PRIMARY KEY (ID));
 
549
CREATE TABLE t2 ( ID int(3) NOT NULL DEFAULT '0' , DATA1 timestamp DEFAULT '0000-00-00 00:00:00' , PRIMARY KEY (ID));
550
550
(SELECT * FROM t1 AS PARTITIONED, t2 AS
551
551
PARTITIONED_B WHERE PARTITIONED_B.ID=PARTITIONED.ID1) UNION
552
552
(SELECT * FROM t1 AS PARTITIONED, t2 AS