1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Avoid an assert() failure that could occur in SQLITE_ENABLE_UPDATE_DELETE_LIMIT builds when a WITH clause attached to an UPDATE or DELETE statement created a CTE of the same name as the table being modified.

FossilOrigin-Name: 8edf56d1698c3db38250db3b25864f658488414efb3a6b3e1443283b6affd26d
This commit is contained in:
dan
2023-05-17 11:31:51 +00:00
parent 010bd47b98
commit 32a5feb53e
5 changed files with 42 additions and 11 deletions

View File

@ -299,5 +299,35 @@ do_test 5.5 {
set ::log
} {ax a bx b cx c dx d ex a}
#-----------------------------------------------------------------------
reset_db
do_execsql_test 6.0 {
CREATE TABLE t2(x);
INSERT INTO t2(x) VALUES(1),(2),(3),(5),(8),(13);
} {}
do_execsql_test 6.1 {
WITH t2 AS MATERIALIZED (VALUES(5))
DELETE FROM t2 ORDER BY rank()OVER() LIMIT 2;
}
do_execsql_test 6.2 {
SELECT * FROM t2;
} {3 5 8 13}
#-------------------------------------------------------------------------
do_execsql_test 7.0 {
CREATE TABLE t1(a INT); INSERT INTO t1(a) VALUES(0);
} {}
do_execsql_test 7.1 {
WITH t1(b) AS (SELECT * FROM (SELECT * FROM (VALUES(2))))
UPDATE t1 SET a=3 LIMIT 1;
}
do_execsql_test 7.2 {
SELECT * FROM t1;
} {3}
finish_test