| Index: third_party/sqlite/src/test/alter4.test
|
| diff --git a/third_party/sqlite/src/test/alter4.test b/third_party/sqlite/src/test/alter4.test
|
| index 738db3fd3b26012fa29262a27a37ecd741b56d03..ac39d614a540b16fe3bbf2c98bdab6f4c4410117 100644
|
| --- a/third_party/sqlite/src/test/alter4.test
|
| +++ b/third_party/sqlite/src/test/alter4.test
|
| @@ -143,6 +143,11 @@ do_test alter4-2.6 {
|
| alter table t1 add column d DEFAULT CURRENT_TIME;
|
| }
|
| } {1 {Cannot add a column with non-constant default}}
|
| +do_test alter4-2.7 {
|
| + catchsql {
|
| + alter table t1 add column d default (-5+1);
|
| + }
|
| +} {1 {Cannot add a column with non-constant default}}
|
| do_test alter4-2.99 {
|
| execsql {
|
| DROP TABLE t1;
|
| @@ -178,7 +183,7 @@ ifcapable schema_version {
|
|
|
| do_test alter4-4.1 {
|
| db close
|
| - file delete -force test.db
|
| + forcedelete test.db
|
| set ::DB [sqlite3 db test.db]
|
| execsql {
|
| CREATE TEMP TABLE t1(a, b);
|
| @@ -213,8 +218,8 @@ do_test alter4-4.99 {
|
|
|
| ifcapable attach {
|
| do_test alter4-5.1 {
|
| - file delete -force test2.db
|
| - file delete -force test2.db-journal
|
| + forcedelete test2.db
|
| + forcedelete test2.db-journal
|
| execsql {
|
| CREATE TEMP TABLE t1(a, b);
|
| INSERT INTO t1 VALUES(1, 'one');
|
| @@ -329,4 +334,25 @@ do_test alter4-8.2 {
|
| }
|
| } [list $::sql]
|
|
|
| +
|
| +# Test that a default value equal to -1 multipied by the smallest possible
|
| +# 64-bit integer is correctly converted to a real.
|
| +do_execsql_test alter4-9.1 {
|
| + CREATE TABLE t5(
|
| + a INTEGER DEFAULT -9223372036854775808,
|
| + b INTEGER DEFAULT (-(-9223372036854775808))
|
| + );
|
| + INSERT INTO t5 DEFAULT VALUES;
|
| +}
|
| +
|
| +do_execsql_test alter4-9.2 { SELECT typeof(a), a, typeof(b), b FROM t5; } {
|
| + integer -9223372036854775808
|
| + real 9.22337203685478e+18
|
| +}
|
| +
|
| +do_execsql_test alter4-9.3 {
|
| + ALTER TABLE t5 ADD COLUMN c INTEGER DEFAULT (-(-9223372036854775808));
|
| + SELECT typeof(c), c FROM t5;
|
| +} {real 9.22337203685478e+18}
|
| +
|
| finish_test
|
|
|