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

Add a few test cases for RETURNING together with UPDATE/DELETE LIMIT.

FossilOrigin-Name: 7611c77d6baa84086ff18cbd045127fd682c6d5c434af5404e34fbe631fedfe1
This commit is contained in:
drh
2021-02-01 21:26:09 +00:00
parent 7baf3d411b
commit d33d3a2ba7
3 changed files with 24 additions and 12 deletions

View File

@ -1,5 +1,5 @@
C Modify\sRETURNING\sso\sthat\sit\sdoes\snot\sreturn\schanges\simplemented\sby\ncascading\sforeign\skeys\sor\sby\striggers. C Add\sa\sfew\stest\scases\sfor\sRETURNING\stogether\swith\sUPDATE/DELETE\sLIMIT.
D 2021-02-01T01:57:55.870 D 2021-02-01T21:26:09.061
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
@ -1752,7 +1752,7 @@ F test/whereK.test f8e3cf26a8513ecc7f514f54df9f0572c046c42b
F test/whereL.test 1afe47227f093dc0547236491fb37529b7be9724b8575925a321001b80e6a23a F test/whereL.test 1afe47227f093dc0547236491fb37529b7be9724b8575925a321001b80e6a23a
F test/wherefault.test 1374c3aa198388925246475f84ad4cd5f9528864 F test/wherefault.test 1374c3aa198388925246475f84ad4cd5f9528864
F test/wherelfault.test 9012e4ef5259058b771606616bd007af5d154e64cc25fa9fd4170f6411db44e3 F test/wherelfault.test 9012e4ef5259058b771606616bd007af5d154e64cc25fa9fd4170f6411db44e3
F test/wherelimit.test 592081800806d297dd7449b1030c863d2883d6d42901837ccd2e5a9bd962edb0 F test/wherelimit.test daa0fd9122c5745cc459ec40b8d3c16ce13ce8382b5b847e7cfff4b871260cbf
F test/wherelimit2.test 657a3f24aadee62d058c5091ea682dc4af4b95ffe32f137155be49799a58e721 F test/wherelimit2.test 657a3f24aadee62d058c5091ea682dc4af4b95ffe32f137155be49799a58e721
F test/win32heap.test 10fd891266bd00af68671e702317726375e5407561d859be1aa04696f2aeee74 F test/win32heap.test 10fd891266bd00af68671e702317726375e5407561d859be1aa04696f2aeee74
F test/win32lock.test fbf107c91d8f5512be5a5b87c4c42ab9fdd54972 F test/win32lock.test fbf107c91d8f5512be5a5b87c4c42ab9fdd54972
@ -1899,7 +1899,7 @@ 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 cb8b797a64f65fca01c5faaeb30cbe4a53b56b81e696d1b62a90362d7ef8f924 P 6e62470a737cbde7f3fdcd027b98eb0b3dd11d063c63501d3c18448e93f5959f
R 199f69fc6dd65199d262c6cd91e2535c R ebbe9120e496309466d7b572d1580227
U drh U drh
Z 013370d4bb9ad0b56cd61fbf8918d3d1 Z 59e7c95767d01f130d57c6f24563b271

View File

@ -1 +1 @@
6e62470a737cbde7f3fdcd027b98eb0b3dd11d063c63501d3c18448e93f5959f 7611c77d6baa84086ff18cbd045127fd682c6d5c434af5404e34fbe631fedfe1

View File

@ -94,21 +94,31 @@ ifcapable {update_delete_limit} {
execsql {DELETE FROM t1 ORDER BY x LIMIT 5} execsql {DELETE FROM t1 ORDER BY x LIMIT 5}
execsql {SELECT count(*) FROM t1} execsql {SELECT count(*) FROM t1}
} {15} } {15}
create_test_data 4
do_test wherelimit-1.3b {
# limit 5
execsql {DELETE FROM t1 RETURNING x, y, '|' ORDER BY x, y LIMIT 5}
} {1 1 | 1 2 | 1 3 | 1 4 | 2 1 |}
do_test wherelimit-1.3c {
execsql {SELECT count(*) FROM t1}
} {11}
do_test wherelimit-1.4 { do_test wherelimit-1.4 {
# limit 5, offset 2 # limit 5, offset 2
execsql {DELETE FROM t1 ORDER BY x LIMIT 5 OFFSET 2} execsql {DELETE FROM t1 RETURNING x, y, '|' ORDER BY x LIMIT 5 OFFSET 2}
} {2 4 | 3 1 | 3 2 | 3 3 | 3 4 |}
do_test wherelimit-1.4cnt {
execsql {SELECT count(*) FROM t1} execsql {SELECT count(*) FROM t1}
} {10} } {6}
do_test wherelimit-1.5 { do_test wherelimit-1.5 {
# limit 5, offset -2 # limit 5, offset -2
execsql {DELETE FROM t1 ORDER BY x LIMIT 5 OFFSET -2} execsql {DELETE FROM t1 ORDER BY x LIMIT 5 OFFSET -2}
execsql {SELECT count(*) FROM t1} execsql {SELECT count(*) FROM t1}
} {5} } {1}
do_test wherelimit-1.6 { do_test wherelimit-1.6 {
# limit -5 (no limit), offset 2 # limit -5 (no limit), offset 2
execsql {DELETE FROM t1 ORDER BY x LIMIT 2, -5} execsql {DELETE FROM t1 ORDER BY x LIMIT 2, -5}
execsql {SELECT count(*) FROM t1} execsql {SELECT count(*) FROM t1}
} {2} } {1}
do_test wherelimit-1.7 { do_test wherelimit-1.7 {
# limit 5, offset -2 (no offset) # limit 5, offset -2 (no offset)
execsql {DELETE FROM t1 ORDER BY x LIMIT -2, 5} execsql {DELETE FROM t1 ORDER BY x LIMIT -2, 5}
@ -227,7 +237,9 @@ ifcapable {update_delete_limit} {
} {11} } {11}
create_test_data 6 create_test_data 6
do_test wherelimit-3.2 { do_test wherelimit-3.2 {
execsql {UPDATE t1 SET y=1 WHERE x=1 LIMIT 5} execsql {UPDATE t1 SET y=1 WHERE x=1 RETURNING x, old.y, '|' LIMIT 5}
} {1 1 | 1 2 | 1 3 | 1 4 | 1 5 |}
do_test wherelimit-3.2cnt {
execsql {SELECT count(*) FROM t1 WHERE y=1} execsql {SELECT count(*) FROM t1 WHERE y=1}
} {10} } {10}
do_test wherelimit-3.3 { do_test wherelimit-3.3 {