3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
6 # May you do good and not evil.
7 # May you find forgiveness for yourself and forgive others.
8 # May you share freely, never taking more than you give.
10 #***********************************************************************
12 # This file implements regression tests for SQLite library. Specifically,
13 # it tests that ticket [8454a207b9fd2243c4c6b7a73f67ea0315717c1a]. Verify
14 # that a negative default value on an added text column actually comes
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
21 # If SQLITE_OMIT_ALTERTABLE is defined, omit this file.
22 ifcapable !altertable {
27 do_test tkt-8454a207b9.1 {
30 INSERT INTO t1 VALUES(1);
31 ALTER TABLE t1 ADD COLUMN b TEXT DEFAULT -123.0;
32 SELECT b, typeof(b) FROM t1;
35 do_test tkt-8454a207b9.2 {
37 ALTER TABLE t1 ADD COLUMN c TEXT DEFAULT -123.5;
38 SELECT c, typeof(c) FROM t1;
41 do_test tkt-8454a207b9.3 {
43 ALTER TABLE t1 ADD COLUMN d TEXT DEFAULT -'hello';
44 SELECT d, typeof(d) FROM t1;
47 do_test tkt-8454a207b9.4 {
49 ALTER TABLE t1 ADD COLUMN e DEFAULT -123.0;
50 SELECT e, typeof(e) FROM t1;
53 do_test tkt-8454a207b9.5 {
55 ALTER TABLE t1 ADD COLUMN f DEFAULT -123.5;
56 SELECT f, typeof(f) FROM t1;
59 do_test tkt-8454a207b9.6 {
61 ALTER TABLE t1 ADD COLUMN g DEFAULT -9223372036854775808;
62 SELECT g, typeof(g) FROM t1;
64 } {-9223372036854775808 integer}
65 do_test tkt-8454a207b9.7 {
67 ALTER TABLE t1 ADD COLUMN h DEFAULT 9223372036854775807;
68 SELECT h, typeof(h) FROM t1;
70 } {9223372036854775807 integer}