~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/range.test

  • Committer: Monty Taylor
  • Date: 2009-04-12 08:14:18 UTC
  • mto: (992.1.1 mordred)
  • mto: This revision was merged to the branch mainline in revision 990.
  • Revision ID: mordred@inaugust.com-20090412081418-dc6gh3g3awkrhwov
Merged compress, uncompress and uncompressed_length into one plugin lib. Yay new plugin registration!

Show diffs side-by-side

added added

removed removed

Lines of Context:
62
62
                      (3,1999,35,0,'1999-07-12');
63
63
select YEAR,ISSUE from t1 where PAPER_ID=3 and (YEAR>1999 or (YEAR=1999 and ISSUE>28))  order by YEAR,ISSUE;
64
64
check table t1;
 
65
repair table t1;
65
66
drop table t1;
66
67
 
67
68
CREATE TABLE t1 (
115
116
# Problem with binary strings
116
117
#
117
118
 
118
 
CREATE TEMPORARY TABLE t1 (
 
119
CREATE TABLE t1 (
119
120
  t1ID int NOT NULL auto_increment,
120
121
  art varbinary(1) NOT NULL default '',
121
122
  KNR char(5) NOT NULL default '',
209
210
# bug #1724: use RANGE on more selective column instead of REF on less
210
211
# selective
211
212
 
212
 
CREATE TEMPORARY TABLE t1 (
 
213
CREATE TABLE t1 (
213
214
  a int default NULL,
214
215
  b int default NULL,
215
216
  KEY a (a),
260
261
# Test of problem with IN on many different keyparts. (Bug #4157)
261
262
#
262
263
 
263
 
CREATE TEMPORARY TABLE t1 (
 
264
CREATE TABLE t1 (
264
265
id int NOT NULL AUTO_INCREMENT ,
265
266
line int NOT NULL default '0',
266
267
columnid int NOT NULL default '0',
312
313
  name char(1) not null,
313
314
  uid int not null,
314
315
  primary key (id),
315
 
  index uid_index (uid));
 
316
  index uid_index (uid)) ENGINE=Myisam;
316
317
  
317
318
create table t2 (
318
319
  id int not null auto_increment,
319
320
  name char(1) not null,
320
321
  uid int not null,
321
322
  primary key (id),
322
 
  index uid_index (uid));
 
323
  index uid_index (uid)) engine=myisam;
323
324
  
324
325
insert into t1(id, uid, name) values(1, 0, ' ');
325
326
insert into t1(uid, name) values(0, ' ');
379
380
 
380
381
analyze table t1,t2;
381
382
 
382
 
--replace_column 3 # 8 # 9 #
383
383
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
384
 
--replace_column 3 # 8 # 9 #
385
384
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid > 0;
386
 
--replace_column 3 # 8 # 9 #
387
385
explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid != 0;
388
 
--replace_column 3 # 8 # 9 #
389
386
explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid != 0;
390
387
 
391
388
select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
540
537
  KEY OXLEFT (OXLEFT),
541
538
  KEY OXRIGHT (OXRIGHT),
542
539
  KEY OXROOTID (OXROOTID)
543
 
);
 
540
) ENGINE=MyISAM;
544
541
 
545
542
INSERT INTO t1 VALUES
546
543
('d8c4177d09f8b11f5.52725521','oxrootid',1,40,'d8c4177d09f8b11f5.52725521'),
555
552
('d8c4177d24ccef970.14957924','d8c4177d09f8b11f5.52725521',10,11,
556
553
 'd8c4177d09f8b11f5.52725521');
557
554
 
558
 
--replace_column 3 # 8 # 9 #
559
 
--sorted_result
560
555
EXPLAIN
561
556
SELECT s.oxid FROM t1 v, t1 s 
562
557
  WHERE s.oxrootid = 'd8c4177d09f8b11f5.52725521' AND
793
788
create table t2 (a varchar(10), filler char(200), key(a));
794
789
insert into t2 select * from t1;
795
790
 
796
 
--replace_column 3 # 8 # 9 #
 
791
--replace_column 9 #
797
792
explain select * from t1 where a between 'a' and 'a '; 
798
 
--replace_column 3 # 8 # 9 #
 
793
--replace_column 9 #
799
794
explain select * from t1 where a = 'a' or a='a ';
800
795
 
801
 
--replace_column 3 # 8 # 9 #
 
796
--replace_column 9 #
802
797
explain select * from t2 where a between 'a' and 'a '; 
803
 
--replace_column 3 # 8 # 9 #
 
798
--replace_column 9 #
804
799
explain select * from t2 where a = 'a' or a='a ';
805
800
 
806
801
update t1 set a='b' where a<>'a';
807
 
--replace_column 3 # 4 # 5 # 6 # 7 # 8 # 9 #
 
802
--replace_column 9 #
808
803
explain select * from t1 where a not between 'b' and 'b'; 
809
804
select a, hex(filler) from t1 where a not between 'b' and 'b'; 
810
805
 
843
838
#             when a range condition use an invalid datetime constant 
844
839
#
845
840
 
846
 
CREATE TEMPORARY TABLE t1 (                                      
 
841
CREATE TABLE t1 (                                      
847
842
  item char(20) NOT NULL default '',                          
848
843
  started datetime, 
849
844
  price decimal(16,3) NOT NULL default '0.000',                 
856
851
('A1','2005-12-12 08:00:00',3000),
857
852
('A2','2005-12-01 08:00:00',1000);
858
853
 
859
 
--replace_column 3 # 8 # 9 #
860
854
EXPLAIN SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
861
855
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 23:59:59';
862
856
SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
962
956
create table t1 (a int);
963
957
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
964
958
 
965
 
create table t2 (a int, b int, filler char(100));
 
959
create table t2 (a int, b int, filler char(100)) ENGINE=myisam;
966
960
insert into t2 select A.a + 10 * (B.a + 10 * C.a), 10, 'filler' from t1 A,
967
961
t1 B, t1 C where A.a < 5;
968
962
 
979
973
# 500 rows, 1 row
980
974
 
981
975
select 'In following EXPLAIN the access method should be ref, #rows~=500 (and not 2)' Z;
982
 
create temporary table t2e like t2;
983
 
alter table t2e engine=myisam;
984
 
insert into t2e select * from t2;
985
 
analyze table t2e;
986
 
explain select * from t2e where a=1000 and b<11;
 
976
explain select * from t2 where a=1000 and b<11;
987
977
 
988
978
drop table t1, t2;
989
979