Column names coming back from a SELECT are now just the name of the
source column without the "table." prefix. In other words, "PRAGMA short_column_names=ON" is now the default. This makes the names of columns behave more like other SQL engines. The old behavior can be restored by setting "PRAGMA short_column_names=OFF". (CVS 2231) FossilOrigin-Name: 9295050af1bf2d9d4dc63adc225a2848d67cbe17
This commit is contained in:
+13
-13
@@ -12,7 +12,7 @@
|
||||
#
|
||||
# This file implements tests for joins, including outer joins.
|
||||
#
|
||||
# $Id: join.test,v 1.13 2004/11/22 13:35:42 danielk1977 Exp $
|
||||
# $Id: join.test,v 1.14 2005/01/18 16:02:40 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -40,32 +40,32 @@ do_test join-1.3 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 NATURAL JOIN t2;
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
} {a 1 b 2 c 3 d 4 a 2 b 3 c 4 d 5}
|
||||
do_test join-1.3.1 {
|
||||
execsql2 {
|
||||
SELECT * FROM t2 NATURAL JOIN t1;
|
||||
}
|
||||
} {t2.b 2 t2.c 3 t2.d 4 t1.a 1 t2.b 3 t2.c 4 t2.d 5 t1.a 2}
|
||||
} {b 2 c 3 d 4 a 1 b 3 c 4 d 5 a 2}
|
||||
do_test join-1.4 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(b,c);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
} {a 1 b 2 c 3 d 4 a 2 b 3 c 4 d 5}
|
||||
do_test join-1.5 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(b);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.c 4 t2.d 5}
|
||||
} {a 1 b 2 c 3 c 3 d 4 a 2 b 3 c 4 c 4 d 5}
|
||||
do_test join-1.6 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(c);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.b 2 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.b 3 t2.d 5}
|
||||
} {a 1 b 2 c 3 b 2 d 4 a 2 b 3 c 4 b 3 d 5}
|
||||
do_test join-1.7 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 INNER JOIN t2 USING(c,b);
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t1.a 2 t1.b 3 t1.c 4 t2.d 5}
|
||||
} {a 1 b 2 c 3 d 4 a 2 b 3 c 4 d 5}
|
||||
|
||||
do_test join-1.8 {
|
||||
execsql {
|
||||
@@ -97,13 +97,13 @@ do_test join-1.13 {
|
||||
SELECT * FROM t1 NATURAL JOIN
|
||||
(SELECT b as 'c', c as 'd', d as 'e' FROM t2) as t3
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t3.d 4 t3.e 5}
|
||||
} {a 1 b 2 c 3 d 4 e 5}
|
||||
do_test join-1.14 {
|
||||
execsql2 {
|
||||
SELECT * FROM (SELECT b as 'c', c as 'd', d as 'e' FROM t2) as 'tx'
|
||||
NATURAL JOIN t1
|
||||
}
|
||||
} {tx.c 3 tx.d 4 tx.e 5 t1.a 1 t1.b 2}
|
||||
} {c 3 d 4 e 5 a 1 b 2}
|
||||
|
||||
do_test join-1.15 {
|
||||
execsql {
|
||||
@@ -123,7 +123,7 @@ do_test join-1.17 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 natural join t2 natural join t3;
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t3.e 5 t1.a 2 t1.b 3 t1.c 4 t2.d 5 t3.e 6}
|
||||
} {a 1 b 2 c 3 d 4 e 5 a 2 b 3 c 4 d 5 e 6}
|
||||
do_test join-1.18 {
|
||||
execsql {
|
||||
CREATE TABLE t4(d,e,f);
|
||||
@@ -133,16 +133,16 @@ do_test join-1.18 {
|
||||
SELECT * FROM t4;
|
||||
}
|
||||
} {2 3 4 3 4 5 4 5 6}
|
||||
do_test join-1.19 {
|
||||
do_test join-1.19.1 {
|
||||
execsql {
|
||||
SELECT * FROM t1 natural join t2 natural join t4;
|
||||
}
|
||||
} {1 2 3 4 5 6}
|
||||
do_test join-1.19 {
|
||||
do_test join-1.19.2 {
|
||||
execsql2 {
|
||||
SELECT * FROM t1 natural join t2 natural join t4;
|
||||
}
|
||||
} {t1.a 1 t1.b 2 t1.c 3 t2.d 4 t4.e 5 t4.f 6}
|
||||
} {a 1 b 2 c 3 d 4 e 5 f 6}
|
||||
do_test join-1.20 {
|
||||
execsql {
|
||||
SELECT * FROM t1 natural join t2 natural join t3 WHERE t1.a=1
|
||||
|
||||
+27
-22
@@ -11,7 +11,7 @@
|
||||
# This file implements regression tests for SQLite library. The
|
||||
# focus of this file is testing the SELECT statement.
|
||||
#
|
||||
# $Id: select1.test,v 1.38 2005/01/15 01:52:33 drh Exp $
|
||||
# $Id: select1.test,v 1.39 2005/01/18 16:02:41 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
@@ -438,7 +438,7 @@ do_test select1-6.7 {
|
||||
set v [catch {execsql2 {SELECT A.f1, t1 FROM test1 as A, test2
|
||||
ORDER BY f2}} msg]
|
||||
lappend v $msg
|
||||
} {0 {A.f1 11 t1 abc A.f1 33 t1 abc}}
|
||||
} {0 {f1 11 t1 abc f1 33 t1 abc}}
|
||||
do_test select1-6.8 {
|
||||
set v [catch {execsql2 {SELECT A.f1, f1 FROM test1 as A, test1 as B
|
||||
ORDER BY f2}} msg]
|
||||
@@ -454,11 +454,16 @@ do_test select1-6.8c {
|
||||
ORDER BY f2}} msg]
|
||||
lappend v $msg
|
||||
} {1 {ambiguous column name: A.f1}}
|
||||
do_test select1-6.9 {
|
||||
do_test select1-6.9.1 {
|
||||
set v [catch {execsql {SELECT A.f1, B.f1 FROM test1 as A, test1 as B
|
||||
ORDER BY A.f1, B.f1}} msg]
|
||||
lappend v $msg
|
||||
} {0 {11 11 11 33 33 11 33 33}}
|
||||
do_test select1-6.9.2 {
|
||||
set v [catch {execsql2 {SELECT A.f1, B.f1 FROM test1 as A, test1 as B
|
||||
ORDER BY A.f1, B.f1}} msg]
|
||||
lappend v $msg
|
||||
} {0 {A.f1 11 B.f1 11 A.f1 11 B.f1 33 A.f1 33 B.f1 11 A.f1 33 B.f1 33}}
|
||||
} {0 {f1 11 f1 11 f1 33 f1 33 f1 11 f1 11 f1 33 f1 33}}
|
||||
|
||||
ifcapable compound {
|
||||
do_test select1-6.10 {
|
||||
@@ -641,16 +646,16 @@ do_test select1-11.1 {
|
||||
SELECT * FROM t3, t4;
|
||||
}
|
||||
} {1 2 3 4}
|
||||
do_test select1-11.2 {
|
||||
do_test select1-11.2.1 {
|
||||
execsql {
|
||||
SELECT * FROM t3, t4;
|
||||
}
|
||||
} {1 2 3 4}
|
||||
do_test select1-11.2.2 {
|
||||
execsql2 {
|
||||
SELECT * FROM t3, t4;
|
||||
}
|
||||
} {t3.a 1 t3.b 2 t4.a 3 t4.b 4}
|
||||
do_test select1-11.3 {
|
||||
execsql2 {
|
||||
SELECT * FROM t3 AS x, t4 AS y;
|
||||
}
|
||||
} {x.a 1 x.b 2 y.a 3 y.b 4}
|
||||
} {a 3 b 4 a 3 b 4}
|
||||
do_test select1-11.4.1 {
|
||||
execsql {
|
||||
SELECT t3.*, t4.b FROM t3, t4;
|
||||
@@ -661,16 +666,16 @@ do_test select1-11.4.2 {
|
||||
SELECT "t3".*, t4.b FROM t3, t4;
|
||||
}
|
||||
} {1 2 4}
|
||||
do_test select1-11.5 {
|
||||
do_test select1-11.5.1 {
|
||||
execsql2 {
|
||||
SELECT t3.*, t4.b FROM t3, t4;
|
||||
}
|
||||
} {t3.a 1 t3.b 2 t4.b 4}
|
||||
} {a 1 b 4 b 4}
|
||||
do_test select1-11.6 {
|
||||
execsql2 {
|
||||
SELECT x.*, y.b FROM t3 AS x, t4 AS y;
|
||||
}
|
||||
} {x.a 1 x.b 2 y.b 4}
|
||||
} {a 1 b 4 b 4}
|
||||
do_test select1-11.7 {
|
||||
execsql {
|
||||
SELECT t3.b, t4.* FROM t3, t4;
|
||||
@@ -680,12 +685,12 @@ do_test select1-11.8 {
|
||||
execsql2 {
|
||||
SELECT t3.b, t4.* FROM t3, t4;
|
||||
}
|
||||
} {t3.b 2 t4.a 3 t4.b 4}
|
||||
} {b 4 a 3 b 4}
|
||||
do_test select1-11.9 {
|
||||
execsql2 {
|
||||
SELECT x.b, y.* FROM t3 AS x, t4 AS y;
|
||||
}
|
||||
} {x.b 2 y.a 3 y.b 4}
|
||||
} {b 4 a 3 b 4}
|
||||
do_test select1-11.10 {
|
||||
catchsql {
|
||||
SELECT t5.* FROM t3, t4;
|
||||
@@ -700,27 +705,27 @@ do_test select1-11.12 {
|
||||
execsql2 {
|
||||
SELECT t3.* FROM t3, (SELECT max(a), max(b) FROM t4)
|
||||
}
|
||||
} {t3.a 1 t3.b 2}
|
||||
} {a 1 b 2}
|
||||
do_test select1-11.13 {
|
||||
execsql2 {
|
||||
SELECT t3.* FROM (SELECT max(a), max(b) FROM t4), t3
|
||||
}
|
||||
} {t3.a 1 t3.b 2}
|
||||
} {a 1 b 2}
|
||||
do_test select1-11.14 {
|
||||
execsql2 {
|
||||
SELECT * FROM t3, (SELECT max(a), max(b) FROM t4) AS 'tx'
|
||||
}
|
||||
} {t3.a 1 t3.b 2 tx.max(a) 3 tx.max(b) 4}
|
||||
} {a 1 b 2 max(a) 3 max(b) 4}
|
||||
do_test select1-11.15 {
|
||||
execsql2 {
|
||||
SELECT y.*, t3.* FROM t3, (SELECT max(a), max(b) FROM t4) AS y
|
||||
}
|
||||
} {y.max(a) 3 y.max(b) 4 t3.a 1 t3.b 2}
|
||||
} {max(a) 3 max(b) 4 a 1 b 2}
|
||||
do_test select1-11.16 {
|
||||
execsql2 {
|
||||
SELECT y.* FROM t3 as y, t4 as z
|
||||
}
|
||||
} {y.a 1 y.b 2}
|
||||
} {a 1 b 2}
|
||||
|
||||
# Tests of SELECT statements without a FROM clause.
|
||||
#
|
||||
@@ -785,7 +790,7 @@ do_test select1-12.10 {
|
||||
SELECT a,b FROM t3 UNION SELECT a AS 'x', b AS 'y' FROM t4 ORDER BY a,b
|
||||
) AS 'z' ORDER BY x;
|
||||
}
|
||||
} {z.x 1 z.x 3}
|
||||
} {x 1 x 3}
|
||||
} ;# ifcapable compound
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user