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

Fix a problem allowing SQL variables to be used expressions within the second and subsequent ON CONFLICT clauses of an UPSERT within a trigger.

FossilOrigin-Name: 2a28910a17dc5b3ce43062fdf879f9622f6ec2db19ed780fa7fe5cae781be7b7
This commit is contained in:
dan
2021-04-21 11:32:22 +00:00
parent 935ad98d60
commit fe599b05f2
4 changed files with 39 additions and 18 deletions

View File

@ -49,6 +49,7 @@
set testdir [file dirname $argv0]
source $testdir/tester.tcl
set testprefix trigger2
ifcapable {!trigger} {
finish_test
return
@ -769,6 +770,24 @@ do_execsql_test trigger2-10.1 {
} ;# ifcapable view
integrity_check trigger2-999
#-------------------------------------------------------------------------
reset_db
do_execsql_test 11.1 {
CREATE TABLE t1(a INT PRIMARY KEY, b, c REAL, d, e);
CREATE TABLE t2(a INT, b, c REAL, d, e, PRIMARY KEY(a,b)) WITHOUT ROWID;
CREATE UNIQUE INDEX t2c ON t2(c);
CREATE UNIQUE INDEX t2d ON t2(d);
CREATE UNIQUE INDEX t2e ON t2(e);
}
do_catchsql_test 11.2 {
CREATE TRIGGER r1 BEFORE INSERT ON t1 BEGIN
INSERT INTO t2(a,b,c,d,e) VALUES(91,NULL,93,94,?1)
ON CONFLICT(b,a) DO NOTHING
ON CONFLICT DO UPDATE SET b=?1;
END;
} {1 {trigger cannot use variables}}
finish_test