aboutsummaryrefslogtreecommitdiff
path: root/test/unique.test
diff options
context:
space:
mode:
Diffstat (limited to 'test/unique.test')
-rw-r--r--test/unique.test41
1 files changed, 36 insertions, 5 deletions
diff --git a/test/unique.test b/test/unique.test
index b483b2571..63d1c37b4 100644
--- a/test/unique.test
+++ b/test/unique.test
@@ -12,7 +12,7 @@
# focus of this file is testing the CREATE UNIQUE INDEX statement,
# and primary keys, and the UNIQUE constraint on table columns
#
-# $Id: unique.test,v 1.6 2003/06/15 23:42:25 drh Exp $
+# $Id: unique.test,v 1.7 2003/08/05 13:13:39 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -47,7 +47,7 @@ do_test unique-1.3 {
catchsql {
INSERT INTO t1(a,b,c) VALUES(1,3,4)
}
-} {1 {uniqueness constraint failed}}
+} {1 {column a is not unique}}
do_test unique-1.4 {
execsql {
SELECT * FROM t1 ORDER BY a;
@@ -57,7 +57,7 @@ do_test unique-1.5 {
catchsql {
INSERT INTO t1(a,b,c) VALUES(3,2,4)
}
-} {1 {uniqueness constraint failed}}
+} {1 {column b is not unique}}
do_test unique-1.6 {
execsql {
SELECT * FROM t1 ORDER BY a;
@@ -98,7 +98,7 @@ do_test unique-2.3 {
catchsql {
INSERT INTO t2 VALUES(1,5);
}
-} {1 {uniqueness constraint failed}}
+} {1 {column a is not unique}}
do_test unique-2.4 {
catchsql {
SELECT * FROM t2 ORDER BY a
@@ -162,7 +162,7 @@ do_test unique-3.4 {
INSERT INTO t3(a,b,c,d) VALUES(1,4,3,5);
SELECT * FROM t3 ORDER BY a,b,c,d;
}
-} {1 {uniqueness constraint failed}}
+} {1 {columns a, c, d are not unique}}
integrity_check unique-3.5
# Make sure NULLs are distinct as far as the UNIQUE tests are
@@ -198,4 +198,35 @@ do_test unique-4.5 {
} {1 2 3 {} 2 {} {} 3 4 2 2 {}}
integrity_check unique-4.6
+# Test the error message generation logic. In particular, make sure we
+# do not overflow the static buffer used to generate the error message.
+#
+do_test unique-5.1 {
+ execsql {
+ CREATE TABLE t5(
+ first_column_with_long_name,
+ second_column_with_long_name,
+ third_column_with_long_name,
+ fourth_column_with_long_name,
+ fifth_column_with_long_name,
+ sixth_column_with_long_name,
+ UNIQUE(
+ first_column_with_long_name,
+ second_column_with_long_name,
+ third_column_with_long_name,
+ fourth_column_with_long_name,
+ fifth_column_with_long_name,
+ sixth_column_with_long_name
+ )
+ );
+ INSERT INTO t5 VALUES(1,2,3,4,5,6);
+ SELECT * FROM t5;
+ }
+} {1 2 3 4 5 6}
+do_test unique-5.2 {
+ catchsql {
+ INSERT INTO t5 VALUES(1,2,3,4,5,6);
+ }
+} {1 {columns first_column_with_long_name, second_column_with_long_name, third_column_with_long_name, fourth_column_with_long_name, fifth_column_with_long_name, ... are not unique}}
+
finish_test