summaryrefslogtreecommitdiff
path: root/test/alter4.test
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:43 -0400
committerHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:43 -0400
commit9f67c0520ea0d5f11a190197cdf746c512db4ce4 (patch)
treec88a33f01f20a3d13a09594f114fffacebd0d1a4 /test/alter4.test
parentee20336e9c78d2e3782c8d096b9ab4f6ca8ce95f (diff)
parent569c6676a6ddb0ff73821d7693b5e18ddef809b9 (diff)
Merge tag 'upstream/3.2.0'
Upstream version 3.2.0 # gpg: Signature made Thu 16 Oct 2014 10:51:39 PM EDT using RSA key ID 374BBE81 # gpg: Good signature from "Hans-Christoph Steiner <hans@guardianproject.info>" # gpg: aka "Hans-Christoph Steiner <hans@eds.org>" # gpg: aka "Hans-Christoph Steiner <hans@at.or.at>" # gpg: aka "[jpeg image of size 5408]"
Diffstat (limited to 'test/alter4.test')
-rw-r--r--test/alter4.test26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/alter4.test b/test/alter4.test
index cda4553..eaad37e 100644
--- a/test/alter4.test
+++ b/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 (-+1);
+ }
+} {1 {Cannot add a column with non-constant default}}
do_test alter4-2.99 {
execsql {
DROP TABLE t1;
@@ -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