diff options
author | Hans-Christoph Steiner <hans@eds.org> | 2013-08-13 15:43:01 -0400 |
---|---|---|
committer | Hans-Christoph Steiner <hans@eds.org> | 2013-08-13 15:43:01 -0400 |
commit | 4228998fd796fa2f9e84fb73632e0a07cc7cd188 (patch) | |
tree | 15b2336f351468fedd0c39e9de4ad905a686f3b0 /test/check.test | |
parent | bdee7cf7d974b2f70d5934786c5666006e7360be (diff) | |
parent | 08119c361d1181b3e8f1abb429236e488a664753 (diff) |
Merge tag 'upstream/2.2.1'
Upstream version 2.2.1
# gpg: Signature made Tue 13 Aug 2013 03:42:56 PM EDT using RSA key ID 374BBE81
# gpg: Good signature from "Hans-Christoph Steiner <hans@at.or.at>"
# gpg: aka "[jpeg image of size 5408]"
# gpg: aka "Hans-Christoph Steiner <hs420@nyu.edu>"
# gpg: aka "Hans-Christoph Steiner <hans@eds.org>"
# gpg: aka "Hans-Christoph Steiner <hans@guardianproject.info>"
# gpg: aka "Hans-Christoph Steiner <hansi@nyu.edu>"
# gpg: aka "Hans-Christoph Steiner <hans@guardianproject.info>"
Diffstat (limited to 'test/check.test')
-rw-r--r-- | test/check.test | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/check.test b/test/check.test index bf0b770..99b72ac 100644 --- a/test/check.test +++ b/test/check.test @@ -15,6 +15,7 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl +set ::testprefix check # Only run these tests if the build includes support for CHECK constraints ifcapable !check { @@ -413,4 +414,42 @@ do_test check-6.15 { } +#-------------------------------------------------------------------------- +# If a connection opens a database that contains a CHECK constraint that +# uses an unknown UDF, the schema should not be considered malformed. +# Attempting to modify the table should fail (since the CHECK constraint +# cannot be tested). +# +reset_db +proc myfunc {x} {expr $x < 10} +db func myfunc myfunc + +do_execsql_test 7.1 { CREATE TABLE t6(a CHECK (myfunc(a))) } +do_execsql_test 7.2 { INSERT INTO t6 VALUES(9) } +do_catchsql_test 7.3 { INSERT INTO t6 VALUES(11) } {1 {constraint failed}} + +do_test 7.4 { + sqlite3 db2 test.db + execsql { SELECT * FROM t6 } db2 +} {9} + +do_test 7.5 { + catchsql { INSERT INTO t6 VALUES(8) } db2 +} {1 {unknown function: myfunc()}} + +do_test 7.6 { + catchsql { CREATE TABLE t7(a CHECK (myfunc(a))) } db2 +} {1 {no such function: myfunc}} + +do_test 7.7 { + db2 func myfunc myfunc + execsql { INSERT INTO t6 VALUES(8) } db2 +} {} + +do_test 7.8 { + db2 func myfunc myfunc + catchsql { INSERT INTO t6 VALUES(12) } db2 +} {1 {constraint failed}} + + finish_test |