From b7ab29ecbe848fd11b9349cb4b86a69f9d02b47a Mon Sep 17 00:00:00 2001 From: "D. Richard Hipp" Date: Tue, 17 Apr 2018 16:16:40 +0000 Subject: [PATCH] New test cases for upsert. --- test/distinct.test | 2 +- test/upsert2.test | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++ test/upsert3.test | 58 ++++++++++++++++++ 3 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 test/upsert2.test create mode 100644 test/upsert3.test diff --git a/test/distinct.test b/test/distinct.test index dac2269b0b..807fb0dd37 100644 --- a/test/distinct.test +++ b/test/distinct.test @@ -168,7 +168,7 @@ foreach {tn sql temptables res} { 6 "b FROM t1 ORDER BY +b COLLATE binary" {btree hash} {B b} 7 "a FROM t1" {} {A a} 8 "b COLLATE nocase FROM t1" {} {b} - 9 "b COLLATE nocase FROM t1 ORDER BY b COLLATE nocase" {} {b} + 9 "b COLLATE nocase FROM t1 ORDER BY b COLLATE nocase" {} {B} } { do_execsql_test 2.$tn.1 "SELECT DISTINCT $sql" $res do_temptables_test 2.$tn.2 "SELECT DISTINCT $sql" $temptables diff --git a/test/upsert2.test b/test/upsert2.test new file mode 100644 index 0000000000..74195644fb --- /dev/null +++ b/test/upsert2.test @@ -0,0 +1,170 @@ +# 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 zipfile + +do_execsql_test upsert2-100 { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b int, c DEFAULT 0); + INSERT INTO t1(a,b) VALUES(1,2),(3,4); + INSERT INTO t1(a,b) VALUES(1,8),(2,11),(3,1) + ON CONFLICT(a) DO UPDATE SET b=excluded.b, c=c+1 WHERE t1.b