1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Fix for bug #2: Add support for TABLE.* in SELECT statements. (CVS 518)

FossilOrigin-Name: c2320eabfe44d6eb05c02b76547e5bd48a29943c
This commit is contained in:
drh
2002-04-04 02:10:55 +00:00
parent f238f700c2
commit 5447322939
7 changed files with 159 additions and 32 deletions

View File

@ -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.22 2002/03/02 17:04:09 drh Exp $
# $Id: select1.test,v 1.23 2002/04/04 02:10:57 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -544,5 +544,86 @@ do_test select1-10.6 {
}
} {11 22}
# Check the ability to specify "TABLE.*" in the result set of a SELECT
#
do_test select1-11.1 {
execsql {
DELETE FROM t3;
DELETE FROM t4;
INSERT INTO t3 VALUES(1,2);
INSERT INTO t4 VALUES(3,4);
SELECT * FROM t3, t4;
}
} {1 2 3 4}
do_test select1-11.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}
do_test select1-11.4 {
execsql {
SELECT t3.*, t4.b FROM t3, t4;
}
} {1 2 4}
do_test select1-11.5 {
execsql2 {
SELECT t3.*, t4.b FROM t3, t4;
}
} {t3.a 1 t3.b 2 t4.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}
do_test select1-11.7 {
execsql {
SELECT t3.b, t4.* FROM t3, t4;
}
} {2 3 4}
do_test select1-11.8 {
execsql2 {
SELECT t3.b, t4.* FROM t3, t4;
}
} {t3.b 2 t4.a 3 t4.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}
do_test select1-11.10 {
catchsql {
SELECT t5.* FROM t3, t4;
}
} {1 {no such table: t5}}
do_test select1-11.11 {
catchsql {
SELECT t3.* FROM t3 AS x, t4;
}
} {1 {no such table: t3}}
do_test select1-11.12 {
execsql2 {
SELECT t3.* FROM t3, (SELECT max(a), max(b) FROM t4)
}
} {t3.a 1 t3.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}
do_test select1-11.14 {
execsql2 {
SELECT * FROM t3, (SELECT max(a), max(b) FROM t4)
}
} {t3.a 1 t3.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}
finish_test