1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Do not allow an empty table bypass to jump outside of a right-join body

subroutine.

FossilOrigin-Name: 1549dcd2353903b70abadd428eeef971ab940df04fb05a6b83b04ee30932db6d
This commit is contained in:
drh
2022-04-18 10:26:50 +00:00
parent d973268ccf
commit d875c7eefe
4 changed files with 25 additions and 20 deletions

View File

@ -35,20 +35,22 @@ do_execsql_test join8-10 {
#
do_test join8-issue-1 {set rc "Issue-1 'row-value subroutine' unresolved"} {}
# Pending issue #2:
# Pending issue #2: (now resolved)
# Jump to addrHalt inside the RIGHT JOIN body subroutine bypasses the
# OP_Return, resulting in a subroutine loop. Test case:
#
# CREATE TABLE t1(a int, b int, c int);
# INSERT INTO t1 VALUES(1,2,3),(4,5,6);
# CREATE TABLE t2(d int, e int);
# INSERT INTO t2 VALUES(3,333),(4,444);
# CREATE TABLE t3(f int, g int);
# PRAGMA automatic_index=off;
# .eqp trace
# SELECT * FROM t1 RIGHT JOIN t2 ON c=d JOIN t3 ON f=e;
#
do_test join8-issue-2 {set rc "Issue-2 'jump to addrHalt' unresolved"} {}
reset_db
do_execsql_test join8-2000 {
CREATE TABLE t1(a int, b int, c int);
INSERT INTO t1 VALUES(1,2,3),(4,5,6);
CREATE TABLE t2(d int, e int);
INSERT INTO t2 VALUES(3,333),(4,444);
CREATE TABLE t3(f int, g int);
PRAGMA automatic_index=off;
} {}
do_catchsql_test join8-2010 {
SELECT * FROM t1 RIGHT JOIN t2 ON c=d JOIN t3 ON f=e;
} {0 {}}
# Demonstrate that nested FULL JOINs and USING clauses work
#