From 86512b11c5460550e84d557836370c92c0a743ce Mon Sep 17 00:00:00 2001 From: drh <> Date: Mon, 20 Jul 2026 16:45:50 +0000 Subject: [PATCH] Additional test cases. FossilOrigin-Name: 3ae4f953de5349c7e90ad245a0c21e513d4ef23d636fd786842619aff12c2d27 --- manifest | 12 ++--- manifest.uuid | 2 +- test/conflict3.test | 125 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 107 insertions(+), 32 deletions(-) diff --git a/manifest b/manifest index 6ff08765e0..5db51d6f8d 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Move\sthe\snew\stest\scases\sfor\sthis\sbranch\sinto\sa\snew\s*.test\sfile. -D 2026-07-20T14:37:21.102 +C Additional\stest\scases. +D 2026-07-20T16:45:50.238 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -995,7 +995,7 @@ F test/colname.test 0e32125de701c6bd86247194c6f5639b740b4f71a0d88ee1e67ff3bda9ae F test/columncount.test 6fe99c2f35738b0129357a1cf3fa483f76140f4cd8a89014c88c33c876d2638f F test/conflict.test 3307ffdf988e04b01c4e942d8aa369a977f085bf629f43a627c9a77f39d65926 F test/conflict2.test 5557909ce683b1073982f5d1b61dfb1d41e369533bfdaf003180c5bc87282dd1 -F test/conflict3.test 81865d9599609aca394fb3b9cd5f561d4729ea5b176bece3644f6ecb540f88ac +F test/conflict3.test 45b32ba8b7a61c3aa48f6a070aeda7963b99fd4d8ac295ab752bf8c0399d931d F test/conflict4.test ac0d4274d63dc3531707c78d112b1f2411a03a71b9801a237fb325d2ff76f0a1 F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4 F test/corrupt.test 54509b182b1927663e0a425b681b0935a08a01b11d8153a4a9545ed36760ebe2 @@ -2216,8 +2216,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 923665823276ee9404a9fdb19378b970eeea77a97bc2f4312446c6f6bc5e4405 -R c590c51c3034bc599664aab2db20c157 +P 7bdce4ec3b9995a13536eaa2e6a5702333e792b35fa58e606b2e4fa38b85f524 +R fd874cf51ef6f97638af9eb563c42ee4 U drh -Z a7c0e72149e007f4528ceaeb8c532ec1 +Z 644b4c4329ddc11381dde7b419c5fd9a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 10ab057005..469552ca15 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7bdce4ec3b9995a13536eaa2e6a5702333e792b35fa58e606b2e4fa38b85f524 +3ae4f953de5349c7e90ad245a0c21e513d4ef23d636fd786842619aff12c2d27 diff --git a/test/conflict3.test b/test/conflict3.test index 8eb4c1b0f7..39e07516e1 100644 --- a/test/conflict3.test +++ b/test/conflict3.test @@ -8,7 +8,6 @@ # May you share freely, never taking more than you give. # #*********************************************************************** -# This file implements regression tests for SQLite library. # # This file implements tests for the conflict resolution extension # to SQLite. @@ -43,17 +42,46 @@ do_execsql_test 1.2 { SELECT a,b,c FROM t1 ORDER BY a; } {1 2 3 2 3 4} -# Insert two rows where the second conflicts on C. The first row show go -# and and then there should be a constraint error. +# Insert two rows where the second conflicts on C. The first row should +# be inserted then there should be a constraint error. # -do_test 1.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 1.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 1.4 { SELECT a,b,c FROM t1 ORDER BY a; } {1 2 3 2 3 4 4 5 6} -# Replete the tests above, but this time on a table non-INTEGER primary key. +# Table t2 is the same as t1 and the tests are the same except +# that t2 has ON CONFLICT ABORT for column c which is overridden +# to IGNORE using an ON CONFLICT clause in the INSERT. +do_execsql_test 1.4 { + CREATE TABLE t2( + a INTEGER PRIMARY KEY ON CONFLICT REPLACE, + b UNIQUE ON CONFLICT IGNORE, + c UNIQUE ON CONFLICT ABORT + ); + INSERT INTO t2(a,b,c) VALUES(1,2,3), (2,3,4); + SELECT a,b,c FROM t2 ORDER BY a; +} {1 2 3 2 3 4} +do_execsql_test 1.5 { + INSERT INTO t2(a,b,c) VALUES(4,5,6), (5,6,4) + ON CONFLICT(c) DO NOTHING; +} {} +do_execsql_test 1.6 { + SELECT a,b,c FROM t2 ORDER BY a; +} {1 2 3 2 3 4 4 5 6} +do_execsql_test 1.7 { + INSERT INTO t2(a,b,c) VALUES(9,3,8),(10,11,12) + ON CONFLICT(c) DO NOTHING; +} {} +do_execsql_test 1.8 { + SELECT a,b,c FROM t2 ORDER BY a; +} {1 2 3 2 3 4 4 5 6 10 11 12} +do_execsql_test 1.99 {PRAGMA integrity_check} ok + + +# Repeat the tests above, but this time on a table non-INTEGER primary key. # do_execsql_test 2.1 { DROP TABLE t1; @@ -83,7 +111,30 @@ do_execsql_test 2.4 { SELECT a,b,c FROM t1 ORDER BY a; } {1 2 3 2 3 4 4 5 6} -# Replete again on a WITHOUT ROWID table. +# Table t2 is the same as t1 and the tests are the same except +# that t2 has ON CONFLICT ABORT for column c which is overridden +# to IGNORE using an ON CONFLICT clause in the INSERT. +do_execsql_test 2.5 { + DROP TABLE t2; + CREATE TABLE t2( + a INT PRIMARY KEY ON CONFLICT REPLACE, + b UNIQUE ON CONFLICT FAIL, + c UNIQUE ON CONFLICT ABORT + ); + INSERT INTO t2(a,b,c) VALUES(1,2,3), (2,3,4); + SELECT a,b,c FROM t2 ORDER BY a; +} {1 2 3 2 3 4} +do_execsql_test 2.6 { + INSERT INTO t2(a,b,c) VALUES(4,5,6), (5,6,4) + ON CONFLICT(c) DO NOTHING; +} {} +do_execsql_test 2.7 { + SELECT a,b,c FROM t2 ORDER BY a; +} {1 2 3 2 3 4 4 5 6} +do_execsql_test 2.99 {PRAGMA integrity_check} ok + + +# Repeat again on a WITHOUT ROWID table. # do_execsql_test 3.1 { DROP TABLE t1; @@ -106,13 +157,35 @@ do_execsql_test 3.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 3.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 3.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 3.4 { SELECT a,b,c FROM t1 ORDER BY a; } {1 2 3 2 3 4 4 5 6} +# Table t2 is the same as t1 and the tests are the same except +# that t2 has ON CONFLICT ABORT for column c which is overridden +# to IGNORE using an ON CONFLICT clause in the INSERT. +do_execsql_test 3.5 { + DROP TABLE t2; + CREATE TABLE t2( + a INT PRIMARY KEY ON CONFLICT REPLACE, + b UNIQUE ON CONFLICT FAIL, + c UNIQUE ON CONFLICT ABORT + ) WITHOUT ROWID; + INSERT INTO t2(a,b,c) VALUES(1,2,3), (2,3,4); + SELECT a,b,c FROM t2 ORDER BY a; +} {1 2 3 2 3 4} +do_execsql_test 3.6 { + INSERT INTO t2(a,b,c) VALUES(4,5,6), (5,6,4) + ON CONFLICT(c) DO NOTHING; +} {} +do_execsql_test 3.7 { + SELECT a,b,c FROM t2 ORDER BY a; +} {1 2 3 2 3 4 4 5 6} +do_execsql_test 3.99 {PRAGMA integrity_check} ok + # Arrange the table rows in a different order and repeat. # do_execsql_test 4.1 { @@ -136,12 +209,13 @@ do_execsql_test 4.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 4.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 4.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 4.4 { SELECT a,b,c FROM t1 ORDER BY a; } {1 2 3 2 3 4 4 5 6} +do_execsql_test 4.99 {PRAGMA integrity_check} ok # Arrange the table rows in a different order and repeat. # @@ -166,8 +240,8 @@ do_execsql_test 5.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 5.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 5.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 5.4 { SELECT a,b,c FROM t1 ORDER BY a; @@ -196,8 +270,8 @@ do_execsql_test 6.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 6.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 6.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 6.4 { SELECT a,b,c FROM t1 ORDER BY a; @@ -226,8 +300,8 @@ do_execsql_test 7.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 7.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 7.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 7.4 { SELECT a,b,c FROM t1 ORDER BY a; @@ -256,8 +330,8 @@ do_execsql_test 8.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 8.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 8.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 8.4 { SELECT a,b,c FROM t1 ORDER BY a; @@ -286,8 +360,8 @@ do_execsql_test 9.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 9.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 9.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 9.4 { SELECT a,b,c FROM t1 ORDER BY a; @@ -316,8 +390,8 @@ do_execsql_test 10.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 10.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 10.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 10.4 { SELECT a,b,c FROM t1 ORDER BY a; @@ -346,8 +420,8 @@ do_execsql_test 11.2 { # Insert two rows where the second conflicts on C. The first row show go # and and then there should be a constraint error. # -do_test 11.3 { - catchsql {INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4);} +do_catchsql_test 11.3 { + INSERT INTO t1(a,b,c) VALUES(4,5,6), (5,6,4); } {1 {UNIQUE constraint failed: t1.c}} do_execsql_test 11.4 { SELECT a,b,c FROM t1 ORDER BY a; @@ -356,6 +430,7 @@ do_execsql_test 11.4 { # Check that ticket [f68dc596c4] has been fixed. # do_execsql_test 12.1 { + DROP TABLE t2; CREATE TABLE t2(a INTEGER PRIMARY KEY, b TEXT); INSERT INTO t2 VALUES(111, '111'); } -- 2.47.3