summaryrefslogtreecommitdiffstats
path: root/test/upsert1.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:16:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 05:16:44 +0000
commit62a67b10ff9f9eea6a4695649fb8252d2a4bc74d (patch)
tree7b54cadc082d323cda5fd24248e85b7d2ea664a3 /test/upsert1.test
parentAdding debian version 3.45.3-1. (diff)
downloadsqlite3-62a67b10ff9f9eea6a4695649fb8252d2a4bc74d.tar.xz
sqlite3-62a67b10ff9f9eea6a4695649fb8252d2a4bc74d.zip
Merging upstream version 3.46.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/upsert1.test')
-rw-r--r--test/upsert1.test24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/upsert1.test b/test/upsert1.test
index 7818311..8af273a 100644
--- a/test/upsert1.test
+++ b/test/upsert1.test
@@ -268,4 +268,28 @@ do_catchsql_test upsert1-1210 {
INSERT INTO t1(a,b) VALUES(1,2) ON CONFLICT(b+?1) DO NOTHING;
} {1 {ON CONFLICT clause does not match any PRIMARY KEY or UNIQUE constraint}}
+# 2024-04-11 https://sqlite.org/forum/forumpost/284955a3cd454a15
+# Incorrect value passed into a trigger that fires as the result of
+# an upsert.
+#
+reset_db
+do_execsql_test upsert1-1300 {
+ CREATE TABLE t1(x INT, y TEXT);
+ INSERT INTO t1 VALUES
+ (11, printf('%.9000c','a')),
+ (11, printf('%.9000c','a')),
+ (33, printf('%.9000c','b')),
+ (33, printf('%.9000c','b'));
+ CREATE TABLE t2(x INT UNIQUE, y TEXT);
+ CREATE TRIGGER r1 BEFORE UPDATE ON t2 BEGIN
+ SELECT raise(ABORT,'Incorrect old.y value passed to trigger!')
+ WHERE old.y != new.y;
+ /* ^^^ This trigger will fire and cause the ABORT if the problem has
+ ** not been fixed, or if there is a regression. */
+ END;
+ INSERT INTO t2(x, y) SELECT x, y FROM t1
+ WHERE true
+ ON CONFLICT (x) DO UPDATE SET y = excluded.y;
+} {}
+
finish_test