mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Do not allow an ON clause to references tables to its right if there is a
RIGHT or LEFT join anywhere in the query. Other RDBMSes prohibit this always, but SQLite must allow ON clauses to reference tables to their right for legacy compatibility, unless there is a RIGHT or LEFT join someplace in the query, in which case there is no legacy to support. FossilOrigin-Name: e615dbe02ca949252d1526ed5c48f8ce08159773ea2008ce666484379d0d9854
This commit is contained in:
@ -741,10 +741,19 @@ do_execsql_test 20.0 {
|
||||
CREATE TABLE t0(a INT);
|
||||
CREATE TABLE t1(b INT);
|
||||
INSERT INTO rt0 VALUES(0, 0, 0);
|
||||
}
|
||||
do_catchsql_test 20.1 {
|
||||
SELECT * FROM t1 JOIN t0 ON x0>a RIGHT JOIN rt0 ON true WHERE +x0 = 0;
|
||||
} {}
|
||||
do_execsql_test 20.1 {
|
||||
} {1 {ON clause references tables to its right}}
|
||||
do_catchsql_test 20.2 {
|
||||
SELECT * FROM t1 JOIN t0 ON x0>a RIGHT JOIN rt0 ON true WHERE x0 = 0;
|
||||
} {}
|
||||
} {1 {ON clause references tables to its right}}
|
||||
db null -
|
||||
do_execsql_test 20.3 {
|
||||
SELECT * FROM t1 JOIN t0 ON true RIGHT JOIN rt0 ON x0>a WHERE +x0 = 0;
|
||||
} {- - 0 0.0 0.0}
|
||||
do_execsql_test 20.4 {
|
||||
SELECT * FROM t1 JOIN t0 ON true RIGHT JOIN rt0 ON x0>a WHERE x0 = 0;
|
||||
} {- - 0 0.0 0.0}
|
||||
|
||||
finish_test
|
||||
|
Reference in New Issue
Block a user