diff options
author | drh <drh@noemail.net> | 2019-12-31 14:49:10 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-12-31 14:49:10 +0000 |
commit | 5f6a2ed7f275a201a8ce9fd81b60a2a552c20f6b (patch) | |
tree | 0a8359d1c5b0829d9a6292e85665979bf364e076 /test/update.test | |
parent | d335bc40a6576d8759466d8efaaaf82b04667aaa (diff) | |
parent | 02ff747bc0a6039cddf6108719426d247026fa18 (diff) | |
download | sqlite-5f6a2ed7f275a201a8ce9fd81b60a2a552c20f6b.tar.gz sqlite-5f6a2ed7f275a201a8ce9fd81b60a2a552c20f6b.zip |
Merge recent enhancements from trunk.
FossilOrigin-Name: 39d55579376906f212271ce9b2d367e3ad029fb173f22c7253312b467970208a
Diffstat (limited to 'test/update.test')
-rw-r--r-- | test/update.test | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/update.test b/test/update.test index 76aba65cd..dd96124b4 100644 --- a/test/update.test +++ b/test/update.test @@ -656,6 +656,78 @@ do_execsql_test update-17.10 { SELECT * FROM t1; } {2 3} +# 2019-12-22 ticket 5ad2aa6921faa1ee +# Make a hard-copy of values that need to be run through OP_RealAffinity +# rather than a soft-copy. This is not strictly necessary, but it avoids +# a memory-accounting assert(). +# +reset_db +do_execsql_test update-18.10 { + PRAGMA encoding = 'UTF16'; + CREATE TABLE t0(c0 REAL, c1); + INSERT INTO t0(c0,c1) VALUES('xyz',11),('uvw',22); + CREATE INDEX i0 ON t0(c1) WHERE c0 GLOB 3; + CREATE INDEX i1 ON t0(c0,c1) WHERE typeof(c0)='text' AND typeof(c1)='integer'; + UPDATE t0 SET c1=345; + SELECT * FROM t0; +} {xyz 345 uvw 345} + +# 2019-12-22 ticket c62c5e58524b204d +# This is really the same underlying problem as 5ad2aa6921faa1ee +# +reset_db +do_execsql_test update-18.20 { + PRAGMA encoding = 'utf16'; + CREATE TABLE t0(c0 TEXT); + CREATE INDEX i0 ON t0(0 LIKE COALESCE(c0, 0)); + INSERT INTO t0(c0) VALUES (0), (0); + SELECT * FROM t0; +} {0 0} + +# 2019-12-28 assertion fault reported by Yongheng +# Similar to ticket ec8abb025e78f40c +# An UPDATE was reaching the OP_Delete after running OP_DeferredSeek +# without ever hitting an OP_Column. The enhanced solution is to +# fix OP_Delete so that it can do the seek itself. +# +reset_db +do_execsql_test update-19.10 { + CREATE TABLE t1( + a TEXT, + b INTEGER PRIMARY KEY UNIQUE + ); + INSERT INTO t1 VALUES(1,2); + UPDATE t1 SET a = quote(b) WHERE b>=2; + SELECT * FROM t1; +} {2 2} +# 2019-12-29 ticket https://www.sqlite.org/src/info/314cc133e5ada126 +# REPLACE conflict resolution during an UPDATE causes a DELETE trigger +# to fire. If that DELETE trigger subsequently modifies the row +# being updated, bad things can happen. Prevent this by prohibiting +# triggers from making changes to the table being updated while doing +# REPLACE conflict resolution on the UPDATE. +# +# See also tickets: +# https://www.sqlite.org/src/info/c1e19e12046d23fe 2019-10-25 +# https://www.sqlite.org/src/info/a8a4847a2d96f5de 2019-10-16 +# +reset_db +do_execsql_test update-20.10 { + PRAGMA recursive_triggers = true; + CREATE TABLE t1(a UNIQUE ON CONFLICT REPLACE, b); + INSERT INTO t1(a,b) VALUES(4,12),(9,13); + CREATE INDEX i0 ON t1(b); + CREATE TRIGGER tr0 DELETE ON t1 BEGIN + UPDATE t1 SET b = a; + END; + PRAGMA integrity_check; +} {ok} +do_catchsql_test update-20.20 { + UPDATE t1 SET a=0; +} {1 {constraint failed}} +do_execsql_test update-20.30 { + PRAGMA integrity_check; +} {ok} finish_test |