-C Add\sthe\s%extra_context\sdirective\sto\slemon,\sas\san\salternative\sto\s%extra_argument.\nUse\sthis\sto\simprove\sthe\sperformance\sof\sthe\sparser.
-D 2018-04-21T13:51:42.935
+C A\sfew\smore\stests\sfor\supsert.
+D 2018-04-21T14:11:18.088
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 5ce9343cba9c189046f1afe6d2bcc1f68079439febc05267b98aec6ecc752439
F test/upsert1.test 934315888a04b4e119ebb6abf558d92bf01d9f94fc8ff0bbc1c7c6015005340f
F test/upsert2.test 9c3cdbb1a890227f6504ce4b0e3de68f4cdfa16bb21d8641208a9239896c5a09
F test/upsert3.test 88d7d590a1948a9cb6eac1b54b0642f67a9f35a1fc0f19b200e97d5d39e3179c
-F test/upsert4.test 1674e23c9d831e39464865a9fa63d855e148eeced8a147e8911febfe7c11f771
+F test/upsert4.test 25d2a1da92f149331ae0c51ca6e3eee78189577585eab92de149900d62994fa5
+F test/upsertfault.test f21ca47740841fdb4d61acfa7b17646d773e67724fe8c185b71c018db8a94b35
F test/uri.test 3481026f00ade6dfe8adb7acb6e1e47b04369568
F test/uri2.test 9d3ba7a53ee167572d53a298ee4a5d38ec4a8fb7
F test/userauth01.test e740a2697a7b40d7c5003a7d7edaee16acd349a9
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 359725ab36339b443b7745e84f6d27991038ceb063c653805dde17f3eb5a03c5
-R f18739f01eafa1a7e4d368678c4dae1f
-U drh
-Z 626b0434bcf85f73e88ad9b2ab679a11
+P be47a6f5262a43f477700579512fe7112a0872faedcbbe5c3383d13a08af6440
+R 3d53f1674a09601b7b69d45626b4c7ca
+U dan
+Z 2cb81c69429d6672e5a93f24af655a26
-be47a6f5262a43f477700579512fe7112a0872faedcbbe5c3383d13a08af6440
\ No newline at end of file
+b78005b6d41640203c163ffde4faf9336f11f47f42e8b7fe10b95415bbaed028
\ No newline at end of file
foreach {tn sql} {
1 {
- CREATE TABLE excluded(w, x, 'a b', z, PRIMARY KEY(x, 'a b'));
+ CREATE TABLE excluded(w, x INTEGER, 'a b', z, PRIMARY KEY(x, 'a b'));
CREATE UNIQUE INDEX zz ON excluded(z);
+ CREATE INDEX zz2 ON excluded(z);
}
2 {
CREATE TABLE excluded(w, x, 'a b', z, PRIMARY KEY(x, 'a b')) WITHOUT ROWID;
CREATE UNIQUE INDEX zz ON excluded(z);
+ CREATE INDEX zz2 ON excluded(z);
}
} {
reset_db
DO UPDATE SET w=excluded.w;
SELECT * FROM excluded;
} {hello 1 1 1 b 2 2 2}
+
+ do_execsql_test 8.$tn.3 {
+ INSERT INTO excluded AS x1 VALUES('hello', 1, 1, NULL) ON CONFLICT(x, [a b])
+ DO UPDATE SET w=w||w WHERE excluded.w!='hello';
+ SELECT * FROM excluded;
+ } {hello 1 1 1 b 2 2 2}
+
+ do_execsql_test 8.$tn.4 {
+ INSERT INTO excluded AS x1 VALUES('hello', 1, 1, NULL) ON CONFLICT(x, [a b])
+ DO UPDATE SET w=w||w WHERE excluded.x=1;
+ SELECT * FROM excluded;
+ } {hellohello 1 1 1 b 2 2 2}
+
+ do_catchsql_test 8.$tn.5 {
+ INSERT INTO excluded AS x1 VALUES('hello', 1, 1, NULL)
+ ON CONFLICT(x, [a b]) WHERE y=1
+ DO UPDATE SET w=w||w WHERE excluded.x=1;
+ } {1 {no such column: y}}
+}
+
+#--------------------------------------------------------------------------
+#
+do_execsql_test 9.0 {
+ CREATE TABLE v(x INTEGER);
+ CREATE TABLE hist(x INTEGER PRIMARY KEY, cnt INTEGER);
+ CREATE TRIGGER vt AFTER INSERT ON v BEGIN
+ INSERT INTO hist VALUES(new.x, 1) ON CONFLICT(x) DO
+ UPDATE SET cnt=cnt+1;
+ END;
+}
+
+do_execsql_test 9.1 {
+ INSERT INTO v VALUES(1), (4), (1), (5), (5), (8), (9), (1);
+ SELECT * FROM hist;
+} {
+ 1 3
+ 4 1
+ 5 2
+ 8 1
+ 9 1
}
--- /dev/null
+# 2018-04-17
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+#
+# Test cases for UPSERT
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+set testprefix upsertfault
+
+do_execsql_test 1.0 {
+ CREATE TABLE t1(a PRIMARY KEY, b, c, d, UNIQUE(b, c));
+ INSERT INTO t1 VALUES(1, 1, 1, 1);
+ INSERT INTO t1 VALUES(2, 2, 2, 2);
+}
+faultsim_save_and_close
+
+do_faultsim_test 1 -faults oom* -prep {
+ faultsim_restore_and_reopen
+ db eval { SELECT * FROM sqlite_master }
+} -body {
+ execsql {
+ INSERT INTO t1 VALUES(3, 2, 2, NULL) ON CONFLICT(b, c) DO
+ UPDATE SET d=d+1;
+ }
+} -test {
+ faultsim_test_result {0 {}}
+}
+
+
+finish_test