mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-18 10:21:03 +03:00
Merge the latest 3.8.6 beta changes from trunk.
FossilOrigin-Name: 68a6d5e2f43702c78057ae2f2a7345c981d24e17
This commit is contained in:
@@ -231,11 +231,11 @@ do_execsql_test in4-3.44 {
|
||||
SELECT * FROM t3 WHERE x IN (10);
|
||||
} {~/OpenEphemeral/}
|
||||
do_execsql_test in4-3.45 {
|
||||
SELECT * FROM t3 WHERE x NOT IN (10,11);
|
||||
SELECT * FROM t3 WHERE x NOT IN (10,11,99999);
|
||||
} {1 1 1}
|
||||
do_execsql_test in4-3.46 {
|
||||
EXPLAIN
|
||||
SELECT * FROM t3 WHERE x NOT IN (10,11);
|
||||
SELECT * FROM t3 WHERE x NOT IN (10,11,99999);
|
||||
} {/OpenEphemeral/}
|
||||
do_execsql_test in4-3.47 {
|
||||
SELECT * FROM t3 WHERE x NOT IN (10);
|
||||
|
||||
@@ -68,6 +68,12 @@ proc multiplex_delete {name} {
|
||||
}
|
||||
|
||||
db close
|
||||
sqlite3_shutdown
|
||||
test_sqlite3_log xLog
|
||||
proc xLog {error_code msg} {
|
||||
lappend ::log $error_code $msg
|
||||
}
|
||||
unset -nocomplain log
|
||||
|
||||
multiplex_delete test.db
|
||||
multiplex_delete test2.db
|
||||
@@ -188,12 +194,16 @@ do_test multiplex-2.3.1 {
|
||||
} {}
|
||||
|
||||
|
||||
unset -nocomplain ::log
|
||||
do_test multiplex-2.4.1 {
|
||||
sqlite3_multiplex_shutdown
|
||||
} {SQLITE_MISUSE}
|
||||
do_test multiplex-2.4.2 {
|
||||
execsql { INSERT INTO t1 VALUES(3, randomblob(1100)) }
|
||||
} {}
|
||||
do_test multiplex-2.4.3 {
|
||||
set ::log
|
||||
} {SQLITE_MISUSE {sqlite3_multiplex_shutdown() called while database connections are still open}}
|
||||
do_test multiplex-2.4.4 { file size [multiplex_name test.x 0] } {7168}
|
||||
do_test multiplex-2.4.5 {
|
||||
db close
|
||||
@@ -583,5 +593,9 @@ do_test multiplex-6.99 {
|
||||
}
|
||||
|
||||
|
||||
catch { db close }
|
||||
catch { sqlite3_multiplex_shutdown }
|
||||
sqlite3_shutdown
|
||||
test_sqlite3_log
|
||||
sqlite3_initialize
|
||||
finish_test
|
||||
|
||||
@@ -431,7 +431,32 @@ Page 6 is never used} {row 1 missing from index i2}}
|
||||
db eval {PRAGMA integrity_check}
|
||||
} {ok}
|
||||
}
|
||||
#exit
|
||||
|
||||
# Verify that PRAGMA integrity_check catches UNIQUE and NOT NULL
|
||||
# constraint violations.
|
||||
#
|
||||
do_execsql_test pragma-3.20 {
|
||||
CREATE TABLE t1(a,b);
|
||||
CREATE INDEX t1a ON t1(a);
|
||||
INSERT INTO t1 VALUES(1,1),(2,2),(3,3),(2,4),(NULL,5),(NULL,6);
|
||||
PRAGMA writable_schema=ON;
|
||||
UPDATE sqlite_master SET sql='CREATE UNIQUE INDEX t1a ON t1(a)'
|
||||
WHERE name='t1a';
|
||||
UPDATE sqlite_master SET sql='CREATE TABLE t1(a NOT NULL,b)'
|
||||
WHERE name='t1';
|
||||
PRAGMA writable_schema=OFF;
|
||||
ALTER TABLE t1 RENAME TO t1x;
|
||||
PRAGMA integrity_check;
|
||||
} {{non-unique entry in index t1a} {NULL value in t1x.a} {non-unique entry in index t1a} {NULL value in t1x.a}}
|
||||
do_execsql_test pragma-3.21 {
|
||||
PRAGMA integrity_check(3);
|
||||
} {{non-unique entry in index t1a} {NULL value in t1x.a} {non-unique entry in index t1a}}
|
||||
do_execsql_test pragma-3.22 {
|
||||
PRAGMA integrity_check(2);
|
||||
} {{non-unique entry in index t1a} {NULL value in t1x.a}}
|
||||
do_execsql_test pragma-3.21 {
|
||||
PRAGMA integrity_check(1);
|
||||
} {{non-unique entry in index t1a}}
|
||||
|
||||
# Test modifying the cache_size of an attached database.
|
||||
ifcapable pager_pragmas&&attach {
|
||||
|
||||
@@ -726,4 +726,51 @@ do_test table-15.2 {
|
||||
execsql {COMMIT}
|
||||
} {}
|
||||
|
||||
# Ticket 3a88d85f36704eebe134f7f48aebf00cd6438c1a (2014-08-05)
|
||||
# The following SQL script segfaults while running the INSERT statement:
|
||||
#
|
||||
# CREATE TABLE t1(x DEFAULT(max(1)));
|
||||
# INSERT INTO t1(rowid) VALUES(1);
|
||||
#
|
||||
# The problem appears to be the use of an aggregate function as part of
|
||||
# the default value for a column. This problem has been in the code since
|
||||
# at least 2006-01-01 and probably before that. This problem was detected
|
||||
# and reported on the sqlite-users@sqlite.org mailing list by Zsbán Ambrus.
|
||||
#
|
||||
do_execsql_test table-16.1 {
|
||||
CREATE TABLE t16(x DEFAULT(max(1)));
|
||||
INSERT INTO t16(x) VALUES(123);
|
||||
SELECT rowid, x FROM t16;
|
||||
} {1 123}
|
||||
do_catchsql_test table-16.2 {
|
||||
INSERT INTO t16(rowid) VALUES(4);
|
||||
} {1 {unknown function: max()}}
|
||||
do_execsql_test table-16.3 {
|
||||
DROP TABLE t16;
|
||||
CREATE TABLE t16(x DEFAULT(abs(1)));
|
||||
INSERT INTO t16(rowid) VALUES(4);
|
||||
SELECT rowid, x FROM t16;
|
||||
} {4 1}
|
||||
do_catchsql_test table-16.4 {
|
||||
DROP TABLE t16;
|
||||
CREATE TABLE t16(x DEFAULT(avg(1)));
|
||||
INSERT INTO t16(rowid) VALUES(123);
|
||||
SELECT rowid, x FROM t16;
|
||||
} {1 {unknown function: avg()}}
|
||||
do_catchsql_test table-16.5 {
|
||||
DROP TABLE t16;
|
||||
CREATE TABLE t16(x DEFAULT(count()));
|
||||
INSERT INTO t16(rowid) VALUES(123);
|
||||
SELECT rowid, x FROM t16;
|
||||
} {1 {unknown function: count()}}
|
||||
do_catchsql_test table-16.6 {
|
||||
DROP TABLE t16;
|
||||
CREATE TABLE t16(x DEFAULT(group_concat('x',',')));
|
||||
INSERT INTO t16(rowid) VALUES(123);
|
||||
SELECT rowid, x FROM t16;
|
||||
} {1 {unknown function: group_concat()}}
|
||||
do_catchsql_test table-16.7 {
|
||||
INSERT INTO t16 DEFAULT VALUES;
|
||||
} {1 {unknown function: group_concat()}}
|
||||
|
||||
finish_test
|
||||
|
||||
@@ -869,6 +869,7 @@ proc speed_trial_summary {name} {
|
||||
#
|
||||
proc finish_test {} {
|
||||
catch {db close}
|
||||
catch {db1 close}
|
||||
catch {db2 close}
|
||||
catch {db3 close}
|
||||
if {0==[info exists ::SLAVE]} { finalize_testing }
|
||||
|
||||
@@ -160,6 +160,10 @@ do_execsql_test tkt-80e031a00f.322 {SELECT 'b' IN t8} 1
|
||||
do_execsql_test tkt-80e031a00f.323 {SELECT 'c' NOT IN t8} 0
|
||||
do_execsql_test tkt-80e031a00f.324 {SELECT 'c' IN t8n} 1
|
||||
do_execsql_test tkt-80e031a00f.325 {SELECT 'd' NOT IN t8n} 0
|
||||
do_execsql_test tkt-80e031a00f.326 {SELECT 'a' IN (NULL,'a')} 1
|
||||
do_execsql_test tkt-80e031a00f.327 {SELECT 'a' IN (NULL,'b')} {{}}
|
||||
do_execsql_test tkt-80e031a00f.328 {SELECT 'a' NOT IN (NULL,'a')} 0
|
||||
do_execsql_test tkt-80e031a00f.329 {SELECT 'a' NOT IN (NULL,'b')} {{}}
|
||||
#
|
||||
# Row 4:
|
||||
do_execsql_test tkt-80e031a00f.400 {SELECT 1 IN (2,3,4,null)} {{}}
|
||||
|
||||
Reference in New Issue
Block a user