~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/join.test

  • Committer: Andrew Hutchings
  • Date: 2011-02-07 17:01:15 UTC
  • mto: (2148.2.3 build)
  • mto: This revision was merged to the branch mainline in revision 2149.
  • Revision ID: andrew@linuxjedi.co.uk-20110207170115-e4sryp5nkb3n2vhy
Implicit joins of the form "SELECT * FROM t1, t2" without WHERE or ON now error.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
CREATE TABLE t2 (S1 INT);
13
13
INSERT INTO t1 VALUES (1);
14
14
INSERT INTO t2 VALUES (2);
 
15
--error ER_CARTESIAN_JOIN_ATTEMPTED
15
16
SELECT * FROM t1 JOIN t2;
 
17
--error ER_CARTESIAN_JOIN_ATTEMPTED
16
18
SELECT * FROM t1 INNER JOIN t2;
17
19
SELECT * from t1 JOIN t2 USING (S1);
18
20
SELECT * FROM t1 INNER JOIN t2 USING (S1);
299
301
CREATE TABLE t1 (a int);
300
302
CREATE TABLE t2 (b int);
301
303
CREATE TABLE t3 (c int);
 
304
--error ER_CARTESIAN_JOIN_ATTEMPTED
302
305
SELECT * FROM t1 NATURAL JOIN t2 NATURAL JOIN t3;
303
306
DROP TABLE t1, t2, t3;
304
307
 
598
601
create table t3 (a int, b int, filler char(100), key(a), key(b));
599
602
 
600
603
insert into t2 
601
 
  select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C;
 
604
  select @a:= A.a + 10*(B.a + 10*C.a), @a, 'filler' from t1 A, t1 B, t1 C where B.a >= 0;
602
605
insert into t3 select * from t2 where a < 800;
603
606
 
604
607
# The order of tables must be t2,t3:
612
615
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
613
616
 
614
617
create table t2 (a int, b int, primary key(a));
615
 
insert into t2 select @v:=A.a+10*B.a, @v  from t1 A, t1 B;
 
618
insert into t2 select @v:=A.a+10*B.a, @v  from t1 A, t1 B where B.a >= 0;
616
619
 
617
620
explain select * from t1;
618
621
--replace_column 2 #