New test cases, one of which is failing, indicating a bug that needs fixing.

FossilOrigin-Name: bd5fd68435ff068c18d7d46b33cf7591263a03c32a917a7df7c087b08c573cc8
This commit is contained in:
drh 2022-04-16 23:38:29 +00:00
parent 052953a4e6
commit 6fda176ba6
5 changed files with 180 additions and 38 deletions

View File

@ -1,5 +1,5 @@
C Fix\sthe\sUSING\sto\sON\stranslation\sso\sthat\sit\sworks\scorrectly\sfor\sa\ssequence\nof\stwo\sor\smore\sjoins\swhere\sone\sof\sthe\sjoins\sto\sthe\sright-hand\sside\sof\sthe\nlist\sis\sa\sRIGHT\sor\sFULL\sJOIN. C New\stest\scases,\sone\sof\swhich\sis\sfailing,\sindicating\sa\sbug\sthat\sneeds\sfixing.
D 2022-04-16T22:57:41.804 D 2022-04-16T23:38:29.234
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -1141,14 +1141,14 @@ F test/ioerr5.test 2edfa4fb0f896f733071303b42224df8bedd9da4
F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b F test/ioerr6.test a395a6ab144b26a9e3e21059a1ab6a7149cca65b
F test/istrue.test e7f285bb70282625c258e866ce6337d4c762922f5a300e1b50f958aef6e7d9c9 F test/istrue.test e7f285bb70282625c258e866ce6337d4c762922f5a300e1b50f958aef6e7d9c9
F test/join.test d9c8cb2769b147b223f9dff8f694f56cfd9d0c097f8af9c7c6562b2e4ad256b5 F test/join.test d9c8cb2769b147b223f9dff8f694f56cfd9d0c097f8af9c7c6562b2e4ad256b5
F test/join2.test 9751dac84a46a960281ca372fe2350252ef40286dde3c542540bccdea9a2d5c6 F test/join2.test 466b07233820f5deee66a6c3bf6e4500c8bbf7b83649e67606f5f649c07928c0
F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0 F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0
F test/join4.test 1a352e4e267114444c29266ce79e941af5885916 F test/join4.test 1a352e4e267114444c29266ce79e941af5885916
F test/join5.test c4df54e2e204d7f1417bfbdd21ca324b4b07415c647595cc47798eacfddc96d3 F test/join5.test c4df54e2e204d7f1417bfbdd21ca324b4b07415c647595cc47798eacfddc96d3
F test/join6.test f809c025fa253f9e150c0e9afd4cef8813257bceeb6f46e04041228c9403cc2c F test/join6.test f809c025fa253f9e150c0e9afd4cef8813257bceeb6f46e04041228c9403cc2c
F test/join7.test e5c9b1b729d7e1d0b4195e99833e0ff0cf2d88e7fdd32b49af1044f4c76f72d9 F test/join7.test e5c9b1b729d7e1d0b4195e99833e0ff0cf2d88e7fdd32b49af1044f4c76f72d9
F test/join8.test 9731b16dbb4309a980ba4adcb4ec31277626230300f819296ffc753c564b2011 F test/join8.test 4f085a233582724be035e83100f458c4cfdd8101699c27feac2782242c037682
F test/join9.test 195c9986d1d1a9840627d610056718c6747e3e6bbc230ac711fe3c4465aa21c7 F test/join9.test afd899f0bda3db6d5fefae2275ad91802d056c7dcd109030100b87e0b75f47ff
F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497 F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497
F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4 F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4
F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ffa140e F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ffa140e
@ -1948,8 +1948,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 6d5d6e0403241c99ab4a47d7b6eedcd8ebc615a8ca8d66d7e81171f901b170d7 P 9ffc2b231956cde1bc90519aa174b0e2dc30ef671ed745f4f3ffa9fbb7ffab4b
R 4be646ba0dcbc3b7d9317327df4f7fe8 R 6e1aaa1b139d709bc01047520c7bb6df
U drh U drh
Z 4c860c34eaaf8b2ecd96a50692d3cbf3 Z d4fc26ab748be0192a3f4dfcc716caef
# Remove this line to create a well-formed Fossil manifest. # Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
9ffc2b231956cde1bc90519aa174b0e2dc30ef671ed745f4f3ffa9fbb7ffab4b bd5fd68435ff068c18d7d46b33cf7591263a03c32a917a7df7c087b08c573cc8

View File

@ -78,10 +78,10 @@ ifcapable subquery {
} {1 11 111 1111 2 22 {} {} 3 33 {} {}} } {1 11 111 1111 2 22 {} {} 3 33 {} {}}
do_test join2-1.7-rj { do_test join2-1.7-rj {
execsql { execsql {
SELECT * FROM SELECT a, b, c, d FROM
(t2 NATURAL JOIN t3) NATURAL RIGHT JOIN t1 t2 NATURAL JOIN t3 NATURAL RIGHT JOIN t1
} }
} {11 111 1111 1 {} {} {} 2 {} {} {} 3} } {1 11 111 1111 2 22 {} {} 3 33 {} {}}
} }
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

View File

@ -50,32 +50,58 @@ do_test join8-issue-1 {set rc "Issue-1 'row-value subroutine' unresolved"} {}
# #
do_test join8-issue-2 {set rc "Issue-2 'jump to addrHalt' unresolved"} {} do_test join8-issue-2 {set rc "Issue-2 'jump to addrHalt' unresolved"} {}
# Pending issue #3: # Demonstrate that nested FULL JOINs and USING clauses work
# USING does not work with RIGHT JOIN.
# Test case:
# #
# CREATE TABLE t4(id INTEGER PRIMARY KEY, x TEXT); reset_db
# CREATE TABLE t5(id INTEGER PRIMARY KEY, y TEXT); load_static_extension db series
# CREATE TABLE t6(id INTEGER PRIMARY KEY, z INT); do_execsql_test join8-3000 {
# CREATE TABLE t1(id INTEGER PRIMARY KEY, a INT);
# INSERT INTO t4(id,x) VALUES(2,'alice'),(4,'bob'),(6,'cindy'),(8,'dave'); CREATE TABLE t2(id INTEGER PRIMARY KEY, b INT);
# INSERT INTO t5(id,y) VALUES(1,'red'),(2,'orange'),(3,'yellow'),(4,'green'), CREATE TABLE t3(id INTEGER PRIMARY KEY, c INT);
# (5,'blue'); CREATE TABLE t4(id INTEGER PRIMARY KEY, d INT);
# INSERT INTO t6(id,z) VALUES(3,333),(4,444),(5,555),(0,1000),(9,999); CREATE TABLE t5(id INTEGER PRIMARY KEY, e INT);
# CREATE TABLE t6(id INTEGER PRIMARY KEY, f INT);
# .mode box CREATE TABLE t7(id INTEGER PRIMARY KEY, g INT);
# SELECT *, t4.id, t5.id, t6.id CREATE TABLE t8(id INTEGER PRIMARY KEY, h INT);
# FROM t4 NATURAL LEFT JOIN t5 NATURAL LEFT JOIN t6 INSERT INTO t1 SELECT value, 1 FROM generate_series(1,256) WHERE value & 1;
# ORDER BY coalesce(t4.id,t5.id,t6.id); INSERT INTO t2 SELECT value, 1 FROM generate_series(1,256) WHERE value & 2;
# INSERT INTO t3 SELECT value, 1 FROM generate_series(1,256) WHERE value & 4;
# SELECT *, t4.id, t5.id, t6.id INSERT INTO t4 SELECT value, 1 FROM generate_series(1,256) WHERE value & 8;
# FROM t4 NATURAL RIGHT JOIN t5 NATURAL RIGHT JOIN t6 INSERT INTO t5 SELECT value, 1 FROM generate_series(1,256) WHERE value & 16;
# ORDER BY coalesce(t4.id,t5.id,t6.id); INSERT INTO t6 SELECT value, 1 FROM generate_series(1,256) WHERE value & 32;
# INSERT INTO t7 SELECT value, 1 FROM generate_series(1,256) WHERE value & 64;
# SELECT *, t4.id, t5.id, t6.id INSERT INTO t8 SELECT value, 1 FROM generate_series(1,256) WHERE value & 128;
# FROM t4 NATURAL FULL JOIN t5 NATURAL FULL JOIN t6 CREATE TABLE t9 AS
# ORDER BY coalesce(t4.id,t5.id,t6.id); SELECT id, h, g, f, e, d, c, b, a
# FROM t1
do_test join8-issue-3 {set rc "Issue-3 'USING' unresolved"} {} NATURAL FULL JOIN t2
NATURAL FULL JOIN t3
NATURAL FULL JOIN t4
NATURAL FULL JOIN t5
NATURAL FULL JOIN t6
NATURAL FULL JOIN t7
NATURAL FULL JOIN t8;
} {}
do_execsql_test join8-3010 {
SELECT count(*) FROM t9;
} {255}
do_execsql_test join8-3020 {
SELECT id, count(*) FROM t9 GROUP BY id HAVING count(*)!=1;
} {}
do_execsql_test join8-3030 {
UPDATE t9 SET a=0 WHERE a IS NULL;
UPDATE t9 SET b=0 WHERE b IS NULL;
UPDATE t9 SET c=0 WHERE c IS NULL;
UPDATE t9 SET d=0 WHERE d IS NULL;
UPDATE t9 SET e=0 WHERE e IS NULL;
UPDATE t9 SET f=0 WHERE f IS NULL;
UPDATE t9 SET g=0 WHERE g IS NULL;
UPDATE t9 SET h=0 WHERE h IS NULL;
SELECT count(*) FROM t9 WHERE id=128*h+64*g+32*f+16*e+8*d+4*c+2*b+a;
} {255}
do_execsql_test join8-3040 {
SELECT * FROM t9 WHERE id<>128*h+64*g+32*f+16*e+8*d+4*c+2*b+a;
} {}
finish_test finish_test

View File

@ -28,6 +28,18 @@ foreach {id schema} {
(5,'blue'); (5,'blue');
INSERT INTO t6(id,z) VALUES(3,333),(4,444),(5,555),(0,1000),(9,999); INSERT INTO t6(id,z) VALUES(3,333),(4,444),(5,555),(0,1000),(9,999);
} }
2 {
CREATE TABLE t3(id INT PRIMARY KEY, w TEXT) WITHOUT ROWID;
CREATE TABLE t4(id INT PRIMARY KEY, x TEXT) WITHOUT ROWID;
CREATE TABLE t5(id INT PRIMARY KEY, y TEXT) WITHOUT ROWID;
CREATE TABLE t6(id INT PRIMARY KEY, z INT) WITHOUT ROWID;
CREATE VIEW dual(dummy) AS VALUES('x');
INSERT INTO t3(id,w) VALUES(2,'two'),(3,'three'),(6,'six'),(7,'seven');
INSERT INTO t4(id,x) VALUES(2,'alice'),(4,'bob'),(6,'cindy'),(8,'dave');
INSERT INTO t5(id,y) VALUES(1,'red'),(2,'orange'),(3,'yellow'),(4,'green'),
(5,'blue');
INSERT INTO t6(id,z) VALUES(3,333),(4,444),(5,555),(0,1000),(9,999);
}
} { } {
reset_db reset_db
db nullvalue - db nullvalue -
@ -161,5 +173,109 @@ foreach {id schema} {
8 dave - - 8 - - 8 dave - - 8 - -
9 - - 999 - - 9 9 - - 999 - - 9
} }
do_execsql_test join9-$id.403 {
SELECT id, x, y, z, t4.id, t5.id, t6.id
FROM t5 NATURAL FULL JOIN t4 NATURAL FULL JOIN t6
ORDER BY id;
} {
0 - - 1000 - - 0
1 - red - - 1 -
2 alice orange - 2 2 -
3 - yellow 333 - 3 3
4 bob green 444 4 4 4
5 - blue 555 - 5 5
6 cindy - - 6 - -
8 dave - - 8 - -
9 - - 999 - - 9
}
do_execsql_test join9-$id.404 {
SELECT id, x, y, z, t4.id, t5.id, t6.id
FROM t5 NATURAL FULL JOIN t6 NATURAL FULL JOIN t4
ORDER BY id;
} {
0 - - 1000 - - 0
1 - red - - 1 -
2 alice orange - 2 2 -
3 - yellow 333 - 3 3
4 bob green 444 4 4 4
5 - blue 555 - 5 5
6 cindy - - 6 - -
8 dave - - 8 - -
9 - - 999 - - 9
}
do_execsql_test join9-$id.405 {
SELECT id, x, y, z, t4.id, t5.id, t6.id
FROM t6 NATURAL FULL JOIN t4 NATURAL FULL JOIN t5
ORDER BY id;
} {
0 - - 1000 - - 0
1 - red - - 1 -
2 alice orange - 2 2 -
3 - yellow 333 - 3 3
4 bob green 444 4 4 4
5 - blue 555 - 5 5
6 cindy - - 6 - -
8 dave - - 8 - -
9 - - 999 - - 9
}
do_execsql_test join9-$id.406 {
SELECT id, x, y, z, t4.id, t5.id, t6.id
FROM t6 NATURAL FULL JOIN t5 NATURAL FULL JOIN t4
ORDER BY id;
} {
0 - - 1000 - - 0
1 - red - - 1 -
2 alice orange - 2 2 -
3 - yellow 333 - 3 3
4 bob green 444 4 4 4
5 - blue 555 - 5 5
6 cindy - - 6 - -
8 dave - - 8 - -
9 - - 999 - - 9
}
# Verified by PG-14 using case 1
do_execsql_test join9-$id.500 {
SELECT id, w, x, y, z
FROM t3 FULL JOIN t4 USING(id)
NATURAL FULL JOIN t5
FULL JOIN t6 USING(id)
ORDER BY 1;
} {
0 - - - 1000
1 - - red -
2 two alice orange -
3 three - yellow 333
4 - bob green 444
5 - - blue 555
6 six cindy - -
7 seven - - -
8 - dave - -
9 - - - 999
}
# Verified by PG-14 using case 1
do_execsql_test join9-$id.600 {
SELECT id, w, x, y, z
FROM t3 JOIN dual ON true
FULL JOIN t4 USING(id)
JOIN dual AS d2 ON true
NATURAL FULL JOIN t5
JOIN dual AS d3 ON true FULL
JOIN t6 USING(id)
CROSS JOIN dual AS d4
ORDER BY 1;
} {
0 - - - 1000
1 - - red -
2 two alice orange -
3 three - yellow 333
4 - bob green 444
5 - - blue 555
6 six cindy - -
7 seven - - -
8 - dave - -
9 - - - 999
}
} }
finish_test finish_test