mirror of
https://github.com/sqlite/sqlite.git
synced 2024-11-29 00:12:23 +01:00
New test cases for RIGHT and FULL JOIN.
FossilOrigin-Name: 5c2f670e0fb35648e1d6e1c48f4d8af815cd57d59eac6ba22e253511bb078870
This commit is contained in:
parent
1c2bf41a12
commit
3b8c7545df
11
manifest
11
manifest
@ -1,5 +1,5 @@
|
||||
C Fix\sthe\squery\sflattener\sso\sthat\sit\sdoes\snot\sflatten\sa\sRIGHT\sor\sFULL\sJOIN\sinto\nany\sposition\sof\sthe\souter\squery\sother\sthan\sthe\sfirst.
|
||||
D 2022-04-18T23:20:02.870
|
||||
C New\stest\scases\sfor\sRIGHT\sand\sFULL\sJOIN.
|
||||
D 2022-04-19T00:24:52.147
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -1149,6 +1149,7 @@ F test/join6.test f809c025fa253f9e150c0e9afd4cef8813257bceeb6f46e04041228c9403cc
|
||||
F test/join7.test 8e72de4b45e5e930d18c305c7efe86015fb2552731e4e03ea226353036b0dab0
|
||||
F test/join8.test 6ed7eed8993e060e5e9d07f6bcadf1bb634742a03b9824afbcfa193adf7f9965
|
||||
F test/join9.test 9056ddd3b0c0f4f9d658f4521038d9a37dc23ead8ca9a505d0b0db2b6a471e05
|
||||
F test/joinA.test 71672b591fe7ea87837b0a22e7e022aa1513f39991c31938f67d63c6a366d66c
|
||||
F test/journal1.test c7b768041b7f494471531e17abc2f4f5ebf9e5096984f43ed17c4eb80ba34497
|
||||
F test/journal2.test 9dac6b4ba0ca79c3b21446bbae993a462c2397c4
|
||||
F test/journal3.test 7c3cf23ffc77db06601c1fcfc9743de8441cb77db9d1aa931863d94f5ffa140e
|
||||
@ -1948,8 +1949,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 49ea11a4a5fd630db44f458304d4f45fa103529ed6b36d538c78074965e8d799
|
||||
R f732ede2542062631f39bbd96137d61f
|
||||
P 837322aa95b1c46201b7dd0c2e6c7b9915b4276d997949f1ecf961fb7f3514cf
|
||||
R 3bb4cbe21854d93bac5653e430f69487
|
||||
U drh
|
||||
Z dd5cee205fd9f7e997652ba77ec73d51
|
||||
Z 7e7983c98db07942264cc173c5b87cf4
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
837322aa95b1c46201b7dd0c2e6c7b9915b4276d997949f1ecf961fb7f3514cf
|
||||
5c2f670e0fb35648e1d6e1c48f4d8af815cd57d59eac6ba22e253511bb078870
|
213
test/joinA.test
Normal file
213
test/joinA.test
Normal file
@ -0,0 +1,213 @@
|
||||
# 2022-04-18
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file implements regression tests for SQLite library.
|
||||
#
|
||||
# This file implements tests for RIGHT and FULL OUTER JOINs.
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
|
||||
foreach {id schema} {
|
||||
1 {
|
||||
CREATE TABLE t1(a INT, b INT, c INT, d INT);
|
||||
CREATE TABLE t2(c INT, d INT, e INT, f INT);
|
||||
CREATE TABLE t3(a INT, b INT, e INT, f INT);
|
||||
CREATE TABLE t4(a INT, c INT, d INT, f INT);
|
||||
INSERT INTO t1 VALUES(11,21,31,41),(12,22,32,42),(15,25,35,45),(18,28,38,48);
|
||||
INSERT INTO t2 VALUES(12,22,32,42),(13,23,33,43),(15,25,35,45),(17,27,37,47);
|
||||
INSERT INTO t3 VALUES(14,24,34,44),(15,25,35,45),(16,26,36,46);
|
||||
INSERT INTO t4 VALUES(11,21,31,41),(13,23,33,43),(16,26,36,46),(19,29,39,49);
|
||||
}
|
||||
2 {
|
||||
CREATE TABLE t1(a INTEGER PRIMARY KEY, b INT, c INT, d INT);
|
||||
CREATE TABLE t2(c INT, d INTEGER PRIMARY KEY, e INT, f INT);
|
||||
CREATE TABLE t3(a INT, b INT, e INTEGER PRIMARY KEY, f INT);
|
||||
CREATE TABLE t4(a INT, c INT, d INT, f INT PRIMARY KEY) WITHOUT ROWID;
|
||||
INSERT INTO t1 VALUES(11,21,31,41),(12,22,32,42),(15,25,35,45),(18,28,38,48);
|
||||
INSERT INTO t2 VALUES(12,22,32,42),(13,23,33,43),(15,25,35,45),(17,27,37,47);
|
||||
INSERT INTO t3 VALUES(14,24,34,44),(15,25,35,45),(16,26,36,46);
|
||||
INSERT INTO t4 VALUES(11,21,31,41),(13,23,33,43),(16,26,36,46),(19,29,39,49);
|
||||
}
|
||||
3 {
|
||||
CREATE TABLE t1a(a INT, b INT, c INT, d INT);
|
||||
CREATE TABLE t2a(c INT, d INT, e INT, f INT);
|
||||
CREATE TABLE t3a(a INT, b INT, e INT, f INT);
|
||||
CREATE TABLE t4a(a INT, c INT, d INT, f INT);
|
||||
INSERT INTO t1a VALUES(11,21,31,41),(12,22,32,42);
|
||||
INSERT INTO t2a VALUES(12,22,32,42),(13,23,33,43);
|
||||
INSERT INTO t3a VALUES(14,24,34,44),(15,25,35,45);
|
||||
INSERT INTO t4a VALUES(11,21,31,41),(13,23,33,43);
|
||||
CREATE TABLE t1b(a INT, b INT, c INT, d INT);
|
||||
CREATE TABLE t2b(c INT, d INT, e INT, f INT);
|
||||
CREATE TABLE t3b(a INT, b INT, e INT, f INT);
|
||||
CREATE TABLE t4b(a INT, c INT, d INT, f INT);
|
||||
INSERT INTO t1b VALUES(15,25,35,45),(18,28,38,48);
|
||||
INSERT INTO t2b VALUES(15,25,35,45),(17,27,37,47);
|
||||
INSERT INTO t3b VALUES(15,25,35,45),(16,26,36,46);
|
||||
INSERT INTO t4b VALUES(16,26,36,46),(19,29,39,49);
|
||||
CREATE VIEW t1 AS SELECT * FROM t1a UNION SELECT * FROM t1b;
|
||||
CREATE VIEW t2 AS SELECT * FROM t2a UNION SELECT * FROM t2b;
|
||||
CREATE VIEW t3 AS SELECT * FROM t3a UNION SELECT * FROM t3b;
|
||||
CREATE VIEW t4 AS SELECT * FROM t4a UNION SELECT * FROM t4b;
|
||||
}
|
||||
} {
|
||||
reset_db
|
||||
db nullvalue -
|
||||
do_execsql_test joinA-$id.setup $schema {}
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.100 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
INNER JOIN t2 USING(c,d)
|
||||
INNER JOIN t3 USING(a,b,f)
|
||||
INNER JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {}
|
||||
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.110 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
LEFT JOIN t2 USING(c,d)
|
||||
LEFT JOIN t3 USING(a,b,f)
|
||||
LEFT JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {
|
||||
11 21 31 41 - - -
|
||||
12 22 32 42 - - -
|
||||
15 25 35 45 - - -
|
||||
18 28 38 48 - - -
|
||||
}
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.120 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
LEFT JOIN t2 USING(c,d)
|
||||
RIGHT JOIN t3 USING(a,b,f)
|
||||
LEFT JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {
|
||||
14 24 - - - 44 34
|
||||
15 25 - - - 45 35
|
||||
16 26 - - - 46 36
|
||||
}
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.130 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
RIGHT JOIN t2 USING(c,d)
|
||||
LEFT JOIN t3 USING(a,b,f)
|
||||
RIGHT JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {
|
||||
11 - 21 31 - 41 -
|
||||
13 - 23 33 - 43 -
|
||||
16 - 26 36 - 46 -
|
||||
19 - 29 39 - 49 -
|
||||
}
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.140 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
FULL JOIN t2 USING(c,d)
|
||||
LEFT JOIN t3 USING(a,b,f)
|
||||
RIGHT JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {
|
||||
11 - 21 31 - 41 -
|
||||
13 - 23 33 - 43 -
|
||||
16 - 26 36 - 46 -
|
||||
19 - 29 39 - 49 -
|
||||
}
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.150 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
RIGHT JOIN t2 USING(c,d)
|
||||
FULL JOIN t3 USING(a,b,f)
|
||||
RIGHT JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {
|
||||
11 - 21 31 - 41 -
|
||||
13 - 23 33 - 43 -
|
||||
16 - 26 36 - 46 -
|
||||
19 - 29 39 - 49 -
|
||||
}
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.160 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
RIGHT JOIN t2 USING(c,d)
|
||||
LEFT JOIN t3 USING(a,b,f)
|
||||
FULL JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {
|
||||
- - 12 22 32 42 -
|
||||
- - 13 23 33 43 -
|
||||
- - 15 25 35 45 -
|
||||
- - 17 27 37 47 -
|
||||
11 - 21 31 - 41 -
|
||||
13 - 23 33 - 43 -
|
||||
16 - 26 36 - 46 -
|
||||
19 - 29 39 - 49 -
|
||||
}
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.170 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
LEFT JOIN t2 USING(c,d)
|
||||
RIGHT JOIN t3 USING(a,b,f)
|
||||
FULL JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {
|
||||
11 - 21 31 - 41 -
|
||||
13 - 23 33 - 43 -
|
||||
14 24 - - - 44 34
|
||||
15 25 - - - 45 35
|
||||
16 26 - - - 46 36
|
||||
16 - 26 36 - 46 -
|
||||
19 - 29 39 - 49 -
|
||||
}
|
||||
|
||||
# Verified by PG-14
|
||||
do_execsql_test joinA-$id.200 {
|
||||
SELECT a,b,c,d,t2.e,f,t3.e
|
||||
FROM t1
|
||||
FULL JOIN t2 USING(c,d)
|
||||
FULL JOIN t3 USING(a,b,f)
|
||||
FULL JOIN t4 USING(a,c,d,f)
|
||||
ORDER BY 1 nulls first, 3 nulls first;
|
||||
} {
|
||||
- - 12 22 32 42 -
|
||||
- - 13 23 33 43 -
|
||||
- - 15 25 35 45 -
|
||||
- - 17 27 37 47 -
|
||||
11 - 21 31 - 41 -
|
||||
11 21 31 41 - - -
|
||||
12 22 32 42 - - -
|
||||
13 - 23 33 - 43 -
|
||||
14 24 - - - 44 34
|
||||
15 25 - - - 45 35
|
||||
15 25 35 45 - - -
|
||||
16 26 - - - 46 36
|
||||
16 - 26 36 - 46 -
|
||||
18 28 38 48 - - -
|
||||
19 - 29 39 - 49 -
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user