| Index: third_party/sqlite/src/test/default.test
|
| diff --git a/third_party/sqlite/src/test/default.test b/third_party/sqlite/src/test/default.test
|
| index 95a4ee039cc84591c42fa6f7f72a741ec5866bbd..406eb53677ab3b6353dc68e98b220dccc56299b4 100644
|
| --- a/third_party/sqlite/src/test/default.test
|
| +++ b/third_party/sqlite/src/test/default.test
|
| @@ -64,4 +64,67 @@ ifcapable pragma {
|
| } {0 c {} 0 'abc' 0}
|
| }
|
|
|
| +do_execsql_test default-3.1 {
|
| + CREATE TABLE t3(
|
| + a INTEGER PRIMARY KEY AUTOINCREMENT,
|
| + b INT DEFAULT 12345 UNIQUE NOT NULL CHECK( b>=0 AND b<99999 ),
|
| + c VARCHAR(123,456) DEFAULT 'hello' NOT NULL ON CONFLICT REPLACE,
|
| + d REAL,
|
| + e FLOATING POINT(5,10) DEFAULT 4.36,
|
| + f NATIONAL CHARACTER(15) COLLATE RTRIM,
|
| + g LONG INTEGER DEFAULT( 3600*12 )
|
| + );
|
| + INSERT INTO t3 VALUES(null, 5, 'row1', '5.25', 'xyz', 321, '432');
|
| + SELECT a, typeof(a), b, typeof(b), c, typeof(c),
|
| + d, typeof(d), e, typeof(e), f, typeof(f),
|
| + g, typeof(g) FROM t3;
|
| +} {1 integer 5 integer row1 text 5.25 real xyz text 321 text 432 integer}
|
| +do_execsql_test default-3.2 {
|
| + DELETE FROM t3;
|
| + INSERT INTO t3 DEFAULT VALUES;
|
| + SELECT * FROM t3;
|
| +} {2 12345 hello {} 4.36 {} 43200}
|
| +do_execsql_test default-3.3 {
|
| + CREATE TABLE t300(
|
| + a INT DEFAULT 2147483647,
|
| + b INT DEFAULT 2147483648,
|
| + c INT DEFAULT +9223372036854775807,
|
| + d INT DEFAULT -2147483647,
|
| + e INT DEFAULT -2147483648,
|
| + f INT DEFAULT -9223372036854775808,
|
| + g INT DEFAULT (-(-9223372036854775808)),
|
| + h INT DEFAULT (-(-9223372036854775807))
|
| + );
|
| + INSERT INTO t300 DEFAULT VALUES;
|
| + SELECT * FROM t300;
|
| +} {2147483647 2147483648 9223372036854775807 -2147483647 -2147483648 -9223372036854775808 9.22337203685478e+18 9223372036854775807}
|
| +
|
| +# Do now allow bound parameters in new DEFAULT values.
|
| +# Silently convert bound parameters to NULL in DEFAULT causes
|
| +# in the sqlite_master table, for backwards compatibility.
|
| +#
|
| +db close
|
| +forcedelete test.db
|
| +sqlite3 db test.db
|
| +do_execsql_test default-4.0 {
|
| + CREATE TABLE t1(a TEXT, b TEXT DEFAULT(99));
|
| + PRAGMA writable_schema=ON;
|
| + UPDATE sqlite_master SET sql='CREATE TABLE t1(a TEXT, b TEXT DEFAULT(:xyz))';
|
| +} {}
|
| +db close
|
| +sqlite3 db test.db
|
| +do_execsql_test default-4.1 {
|
| + INSERT INTO t1(a) VALUES('xyzzy');
|
| + SELECT a, quote(b) FROM t1;
|
| +} {xyzzy NULL}
|
| +do_catchsql_test default-4.2 {
|
| + CREATE TABLE t2(a TEXT, b TEXT DEFAULT(:xyz));
|
| +} {1 {default value of column [b] is not constant}}
|
| +do_catchsql_test default-4.3 {
|
| + CREATE TABLE t2(a TEXT, b TEXT DEFAULT(abs(:xyz)));
|
| +} {1 {default value of column [b] is not constant}}
|
| +do_catchsql_test default-4.4 {
|
| + CREATE TABLE t2(a TEXT, b TEXT DEFAULT(98+coalesce(5,:xyz)));
|
| +} {1 {default value of column [b] is not constant}}
|
| +
|
| finish_test
|
|
|