aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/auth2.test12
-rw-r--r--test/auth3.test21
-rw-r--r--test/parser1.test23
3 files changed, 42 insertions, 14 deletions
diff --git a/test/auth2.test b/test/auth2.test
index a9d64d08a..08d46cac5 100644
--- a/test/auth2.test
+++ b/test/auth2.test
@@ -98,12 +98,6 @@ SQLITE_UPDATE sqlite_master tbl_name main {}
SQLITE_UPDATE sqlite_master rootpage main {}
SQLITE_UPDATE sqlite_master sql main {}
SQLITE_READ sqlite_master ROWID main {}
-SQLITE_READ sqlite_master name main {}
-SQLITE_READ sqlite_master rootpage main {}
-SQLITE_READ sqlite_master sql main {}
-SQLITE_READ sqlite_master tbl_name main {}
-SQLITE_READ sqlite_master type main {}
-SQLITE_READ sqlite_master ROWID main {}
}
do_test auth2-2.2 {
set ::authargs {}
@@ -119,12 +113,6 @@ SQLITE_UPDATE sqlite_master tbl_name main {}
SQLITE_UPDATE sqlite_master rootpage main {}
SQLITE_UPDATE sqlite_master sql main {}
SQLITE_READ sqlite_master ROWID main {}
-SQLITE_READ sqlite_master name main {}
-SQLITE_READ sqlite_master rootpage main {}
-SQLITE_READ sqlite_master sql main {}
-SQLITE_READ sqlite_master tbl_name main {}
-SQLITE_READ sqlite_master type main {}
-SQLITE_READ sqlite_master ROWID main {}
}
do_test auth2-2.3 {
set ::authargs {}
diff --git a/test/auth3.test b/test/auth3.test
index eef10b398..ca7e16c84 100644
--- a/test/auth3.test
+++ b/test/auth3.test
@@ -12,8 +12,7 @@
# Test that the truncate optimization is disabled if the SQLITE_DELETE
# authorization callback returns SQLITE_IGNORE.
#
-# $Id: auth3.test,v 1.2 2009/05/04 01:58:31 drh Exp $
-#
+# Test that authorizer is disabled during schema parsing.
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -108,4 +107,22 @@ do_test auth3-2.2 {
set sqlite_search_count
} {1}
+# 2016-07-28. A problem report from a private client complaining about
+# an authorizer failure during an ALTER TABLE. The solution (I think) is
+# to disable the authorizer during schema parsing.
+#
+proc auth {code args} {
+ if {$code=="SQLITE_READ" && [regexp {DoNotRead} $args]} {
+ return SQLITE_DENY
+ }
+ return SQLITE_OK
+}
+do_execsql_test auth3-3.0 {
+ CREATE TEMPORARY TABLE TempTable (
+ key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE,
+ value TEXT NOT NULL ON CONFLICT FAIL);
+ ALTER TABLE TempTable RENAME TO DoNotRead;
+ SELECT name FROM sqlite_temp_master;
+} {DoNotRead sqlite_autoindex_DoNotRead_1}
+
finish_test
diff --git a/test/parser1.test b/test/parser1.test
index 78c1a40c6..c708dded1 100644
--- a/test/parser1.test
+++ b/test/parser1.test
@@ -76,4 +76,27 @@ do_catchsql_test parser1-2.2 {
SELECT x FROM c;
} {1 {syntax error after column name "x"}}
+# Verify that the comma between multiple table constraints is
+# optional.
+#
+# The missing comma is technically a syntax error. But we have to support
+# it because there might be legacy databases that omit the commas in their
+# sqlite_master tables.
+#
+do_execsql_test parser1-3.1 {
+ CREATE TABLE t300(id INTEGER PRIMARY KEY);
+ CREATE TABLE t301(
+ id INTEGER PRIMARY KEY,
+ c1 INTEGER NOT NULL,
+ c2 INTEGER NOT NULL,
+ c3 BOOLEAN NOT NULL DEFAULT 0,
+ FOREIGN KEY(c1) REFERENCES t300(id) ON DELETE CASCADE ON UPDATE RESTRICT
+ /* no comma */
+ FOREIGN KEY(c2) REFERENCES t300(id) ON DELETE CASCADE ON UPDATE RESTRICT
+ /* no comma */
+ UNIQUE(c1, c2)
+ );
+ PRAGMA foreign_key_list(t301);
+} {0 0 t300 c2 id RESTRICT CASCADE NONE 1 0 t300 c1 id RESTRICT CASCADE NONE}
+
finish_test