~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/join_outer.test

  • Committer: Jay Pipes
  • Date: 2009-01-30 04:01:12 UTC
  • mto: This revision was merged to the branch mainline in revision 830.
  • Revision ID: jpipes@serialcoder-20090130040112-svbn774guj98pwi4
To remain in compatibility with MySQL, added ability to interpret
decimal arguments as datetime strings for temporal functions.

Fixed YEAR(), MONTH(), DAYOFMONTH(), DAYOFYEAR(), HOUR(), MINUTE(), SECOND(), and MICROSECOND()
to accept decimal parameters and interpret them the same way as MySQL.

Fixed an issue with the TemporalFormat::matches() method which was 
incorrectly assuming all microsecond arguments were specified as 6 digits.
Added power of 10 multiplier to usecond calculation. This fixes issues with
failures in type_date and func_sapdb test cases.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
  grp int default NULL,
11
11
  a bigint default NULL,
12
12
  c char(10) NOT NULL default ''
13
 
);
 
13
) ENGINE=MyISAM;
14
14
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b'),(2,3,'c'),(3,4,'E'),(3,5,'C'),(3,6,'D'),(NULL,NULL,'');
15
15
create table t2 (id int, a bigint not null, c char(10), d int, primary key (a));
16
16
insert into t2 values (1,1,"a",1),(3,4,"A",4),(3,5,"B",5),(3,6,"C",6),(4,7,"D",7);
28
28
select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id=3;
29
29
select t1.*,t2.* from t1 left join t2 on (t1.a=t2.a) where t2.id is null;
30
30
 
31
 
--replace_column 9 #
32
31
explain select t1.*,t2.* from t1,t2 where t1.a=t2.a and isnull(t2.a)=1;
33
 
--replace_column 9 #
34
32
explain select t1.*,t2.* from t1 left join t2 on t1.a=t2.a where isnull(t2.a)=1;
35
33
 
36
34
select t1.*,t2.*,t3.a from t1 left join t2 on (t1.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
37
35
 
38
36
# The next query should rearange the left joins to get this to work
39
 
--error ER_BAD_FIELD_ERROR
 
37
--error 1054
40
38
explain select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
41
 
--error ER_BAD_FIELD_ERROR
 
39
--error 1054
42
40
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t1.a=t3.a);
43
41
 
44
42
# The next query should give an error in MySQL
45
 
--error ER_BAD_FIELD_ERROR
 
43
--error 1054
46
44
select t1.*,t2.*,t3.a from t1 left join t2 on (t3.a=t2.a) left join t1 as t3 on (t2.a=t3.a);
47
45
 
48
46
# Test of inner join
294
292
insert into t4 values (1,1);
295
293
insert into t5 values (1,1);
296
294
 
297
 
--error ER_BAD_FIELD_ERROR
 
295
--error 1054
298
296
explain select * from t3 left join t4 on t4.seq_1_id = t2.t2_id left join t1 on t1.t1_id = t4.seq_0_id left join t5 on t5.seq_0_id = t1.t1_id left join t2 on t2.t2_id = t5.seq_1_id where t3.t3_id = 23;
299
297
 
300
298
drop table t1,t2,t3,t4,t5;
344
342
insert into t2 values (7, 'green');
345
343
select * from t1;
346
344
select * from t2;
347
 
--sorted_result
348
345
select * from t2 natural join t1;
349
 
--sorted_result
350
346
select t2.count, t1.name from t2 natural join t1;
351
 
--sorted_result
352
347
select t2.count, t1.name from t2 inner join t1 using (color);
353
348
drop table t1;
354
349
drop table t2;
542
537
 
543
538
drop table t1, t2;
544
539
 
545
 
CREATE TEMPORARY TABLE t1 (
 
540
CREATE TABLE t1 (
546
541
  ts_id bigint default NULL,
547
542
  inst_id int default NULL,
548
543
  flag_name varchar(64) default NULL,
550
545
  UNIQUE KEY ts_id (ts_id,inst_id,flag_name)
551
546
) ENGINE=MyISAM;
552
547
 
553
 
CREATE TEMPORARY TABLE t2 (
 
548
CREATE TABLE t2 (
554
549
  ts_id bigint default NULL,
555
550
  inst_id int default NULL,
556
551
  flag_name varchar(64) default NULL,
798
793
 
799
794
flush status;
800
795
SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL;
801
 
--replace_column 2 #
802
796
show status like 'Handler_read%';
803
797
 
804
798
DROP TABLE t1,t2;