Add further tests for VALUES clauses in various contexts.

FossilOrigin-Name: 973d197d9676c066a95cea77a27e36d2d7f5778283919d8cac4424d2ec952f47
This commit is contained in:
dan 2024-03-14 11:45:39 +00:00
parent 56be6f6c08
commit a06c046e29
3 changed files with 98 additions and 7 deletions

View File

@ -1,5 +1,5 @@
C Change\sthe\sway\sparse.y\shandles\smulti-row\sVALUES\sclauses\sto\ssave\sa\sfew\scycles.
D 2024-03-13T20:04:11.997
C Add\sfurther\stests\sfor\sVALUES\sclauses\sin\svarious\scontexts.
D 2024-03-14T11:45:39.711
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -1921,7 +1921,7 @@ F test/vacuum4.test 7ea76b769fffeb41f925303b04cbcf5a5bbeabe55e4c60ae754ff24eeeb7
F test/vacuum5.test 263b144d537e92ad8e9ca8a73cc6e1583f41cfd0dda9432b87f7806174a2f48c
F test/vacuum6.test b137b04bf3392d3f5c3b8fda0ce85a6775a70ca112f6559f74ff52dc9ce042fd
F test/vacuummem.test 4b30f5b95a9ff86e9d5c20741e50a898b2dc10b0962a3211571eb165357003fb
F test/values.test 1f0a7f8468d7f087bc4add7a95545afb15e22d5e629a18fbea73b9d76f3ef8bd
F test/values.test 97a12553a3bb5bae5bdd924e1bdc53540e59d255f5072fe1f744412497ffb8e9
F test/valuesfault.test 2ef23ed965e3bd08e268cdc38a0d11653390ddbbe1e8e2e98d16f55edd30f6e8
F test/varint.test bbce22cda8fc4d135bcc2b589574be8410614e62
F test/veryquick.test 57ab846bacf7b90cf4e9a672721ea5c5b669b661
@ -2179,8 +2179,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 657c7b4f9df53e041a33cfad00ee2f507ac09c97a2ae61164bd189d660d167da
R c74bcaf2a43ef6c41ceff5cdf5beeb0e
P 88d5bc91a52675d2a83748b79ad50de0e9732b2afd23107627bdc604f744d275
R ff7025814ffdce6724f42ac930401faa
U dan
Z dc10b4e059ebbb23528a1aebd608a6c4
Z a6579ddbeb44182b511c7d09df6cac16
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
88d5bc91a52675d2a83748b79ad50de0e9732b2afd23107627bdc604f744d275
973d197d9676c066a95cea77a27e36d2d7f5778283919d8cac4424d2ec952f47

View File

@ -280,5 +280,96 @@ do_execsql_test 7.1 {
a b a b
}
#-------------------------------------------------------------------------
reset_db
set VVV {
( VALUES('a', 'b'), ('c', 'd'), (123, NULL) )
}
set VVV2 {
(
SELECT 'a' AS column1, 'b' AS column2
UNION ALL SELECT 'c', 'd' UNION ALL SELECT 123, NULL
)
}
do_execsql_test 8.0 {
CREATE TABLE t1(x);
INSERT INTO t1 VALUES('d'), (NULL), (123)
}
foreach {tn q res} {
1 "SELECT * FROM t1 LEFT JOIN VVV" {
d a b d c d d 123 {}
{} a b {} c d {} 123 {}
123 a b 123 c d 123 123 {}
}
2 "SELECT * FROM t1 LEFT JOIN VVV ON (column1=x)" {
d {} {}
{} {} {}
123 123 {}
}
3 "SELECT * FROM t1 RIGHT JOIN VVV" {
d a b d c d d 123 {}
{} a b {} c d {} 123 {}
123 a b 123 c d 123 123 {}
}
4 "SELECT * FROM t1 RIGHT JOIN VVV ON (column1=x)" {
123 123 {}
{} a b
{} c d
}
5 "SELECT * FROM t1 FULL OUTER JOIN VVV ON (column1=x)" {
d {} {}
{} {} {}
123 123 {}
{} a b
{} c d
}
6 "SELECT count(*) FROM VVV" { 3 }
7 "SELECT (SELECT column1 FROM VVV)" { a }
8 "SELECT * FROM VVV UNION ALL SELECT * FROM VVV" {
a b c d 123 {}
a b c d 123 {}
}
9 "SELECT * FROM VVV INTERSECT SELECT * FROM VVV" {
123 {} a b c d
}
10 "SELECT * FROM VVV eXCEPT SELECT * FROM VVV" { }
11 "SELECT * FROM VVV eXCEPT SELECT 'a', 'b'" { 123 {} c d }
} {
set q1 [string map [list VVV $VVV] $q]
set q2 [string map [list VVV $VVV2] $q]
set q3 "WITH VVV AS $VVV $q"
do_execsql_test 8.1.$tn.1 $q1 $res
do_execsql_test 8.1.$tn.2 $q2 $res
do_execsql_test 8.1.$tn.3 $q3 $res
}
#-------------------------------------------------------------------------
reset_db
do_execsql_test 9.1 {
VALUES(456), (123), (NULL) UNION ALL SELECT 122 ORDER BY 1
} { {} 122 123 456 }
do_execsql_test 9.2 {
VALUES (1, 2), (3, 4), (
( SELECT column1 FROM ( VALUES (5, 6), (7, 8) ) ),
( SELECT max(column2) FROM ( VALUES (5, 1), (7, 6) ) )
)
} { 1 2 3 4 5 6 }
finish_test