diff --git a/manifest b/manifest index 27bc758d0d..022cd5679e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Throw\san\serror\sif\sAUTOINCREMENT\sappears\sin\sa\sWITHOUT\sROWID\stable.\s\s\nUpdates\sto\sAPI\sdocumentation\sto\sdiscuss\sWITHOUT\sROWID. -D 2013-11-09T18:15:35.427 +C Updates\sto\srequirements\smarks.\s\sNo\schanges\sto\scode. +D 2013-11-09T19:47:15.808 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in d12e4455cf7a36e42d3949876c1c3b88ff70867a F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -177,7 +177,7 @@ F src/delete.c ddb92f44595366c4817e576b5f11cad5a915c3ef F src/expr.c e7bbe3c6916e141f27a28655d3cf325b817695e4 F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 78364daed38e26269c53ddb94c515bceac1063c6 -F src/func.c 2c47b65e6e00e3e9374942f28254faf8adafe398 +F src/func.c 96caa9dfd1febf9a4b720de4c43ccfb392a52b73 F src/global.c 5caf4deab621abb45b4c607aad1bd21c20aac759 F src/hash.c ac3470bbf1ca4ae4e306a8ecb0fdf1731810ffe4 F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22 @@ -431,7 +431,7 @@ F test/descidx3.test 09ddbe3f5295f482d2f8b687cf6db8bad7acd9a2 F test/diskfull.test 106391384780753ea6896b7b4f005d10e9866b6e F test/distinct.test 44028aaf161a5e80a2f229622b3a174d3b352810 F test/distinctagg.test 1a6ef9c87a58669438fc771450d7a72577417376 -F test/e_createtable.test f1d21fa142391917b1fa84cf985ac6c63dfcbe4d +F test/e_createtable.test 3b453432cd14a12732ee9467597d2274ca37ce36 F test/e_delete.test d5186e2f5478b659f16a2c8b66c09892823e542a F test/e_droptrigger.test 3cd080807622c13e5bbb61fc9a57bd7754da2412 F test/e_dropview.test 0c9f7f60989164a70a67a9d9c26d1083bc808306 @@ -1135,7 +1135,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 0077c0772a884b54d81fa3733aac6f0c364ef1a8 -R 563b03556821aa7157a2f09d27059ceb +P b1abb2b078d1cb9ec5fbd7f98221914b93632e9f +R aea40f11c282f7222fc2eec8280533e7 U drh -Z 70e0a7dbdf3eec5dcb68edfd8a49c4f3 +Z 2a612035828de77b6077cfc0ffcba71e diff --git a/manifest.uuid b/manifest.uuid index b3f5c9c136..7db13c15d5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -b1abb2b078d1cb9ec5fbd7f98221914b93632e9f \ No newline at end of file +8a0366285b94dc43d932736e7b1eedb71e241857 \ No newline at end of file diff --git a/src/func.c b/src/func.c index e2ab68f030..c9962f6d91 100644 --- a/src/func.c +++ b/src/func.c @@ -138,8 +138,8 @@ static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ i64 iVal = sqlite3_value_int64(argv[0]); if( iVal<0 ){ if( (iVal<<1)==0 ){ - /* IMP: R-35460-15084 If X is the integer -9223372036854775807 then - ** abs(X) throws an integer overflow error since there is no + /* IMP: R-31676-45509 If X is the integer -9223372036854775808 + ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ sqlite3_result_error(context, "integer overflow", -1); return; diff --git a/test/e_createtable.test b/test/e_createtable.test index 6fef5e3c42..8b57c73971 100644 --- a/test/e_createtable.test +++ b/test/e_createtable.test @@ -1103,8 +1103,8 @@ do_catchsql_test e_createtable-3.11.5 { # EVIDENCE-OF: R-52382-54248 Each table in SQLite may have at most one # PRIMARY KEY. # -# EVIDENCE-OF: R-18080-47271 If there is more than one PRIMARY KEY -# clause in a single CREATE TABLE statement, it is an error. +# EVIDENCE-OF: R-62315-57691 An error is rasied if more than one PRIMARY +# KEY clause appears in a CREATE TABLE statement. # # To test the two above, show that zero primary keys is Ok, one primary # key is Ok, and two or more primary keys is an error. @@ -1127,6 +1127,17 @@ do_createtable_tests 4.1.2 -error { 6 "CREATE TABLE t5(a INTEGER PRIMARY KEY, b, c, PRIMARY KEY(a))" {} } +# EVIDENCE-OF: R-54755-39291 The PRIMARY KEY is optional for ordinary +# tables but is required for WITHOUT ROWID tables. +# +do_catchsql_test 4.1.3 { + CREATE TABLE t6(a, b); --ok +} {0 {}} +do_catchsql_test 4.1.4 { + CREATE TABLE t7(a, b) WITHOUT ROWID; --Error, no PRIMARY KEY +} {1 {PRIMARY KEY missing on table t7}} + + proc table_pk {tbl} { set pk [list] db eval "pragma table_info($tbl)" a { @@ -1160,8 +1171,8 @@ do_createtable_tests 4.2 -repair { 2.3 "CREATE TABLE t5(a, b INTEGER PRIMARY KEY, c)" {b} } -# EVIDENCE-OF: R-33986-09410 Each row in a table with a primary key must -# feature a unique combination of values in its primary key columns. +# EVIDENCE-OF: R-59124-61339 Each row in a table with a primary key must +# have a unique combination of values in its primary key columns. # # EVIDENCE-OF: R-39102-06737 If an INSERT or UPDATE statement attempts # to modify the table content so that two or more rows feature identical @@ -1252,8 +1263,9 @@ do_createtable_tests 4.4 { 14 "INSERT INTO t2 VALUES(NULL, NULL)" {} } -# EVIDENCE-OF: R-61866-38053 Unless the column is an INTEGER PRIMARY KEY -# SQLite allows NULL values in a PRIMARY KEY column. +# EVIDENCE-OF: R-35113-43214 Unless the column is an INTEGER PRIMARY KEY +# or the table is a WITHOUT ROWID table or the column is declared NOT +# NULL, SQLite allows NULL values in a PRIMARY KEY column. # # If the column is an integer primary key, attempting to insert a NULL # into the column triggers the auto-increment behavior. Attempting @@ -1275,6 +1287,14 @@ do_catchsql_test 4.5.3 { INSERT INTO t3 VALUES(2, 5, 3); UPDATE t3 SET u = NULL WHERE s = 2; } {1 {datatype mismatch}} +do_catchsql_test 4.5.4 { + CREATE TABLE t4(s, u INT PRIMARY KEY, v) WITHOUT ROWID; + INSERT INTO t4 VALUES(1, NULL, 2); +} {1 {NOT NULL constraint failed: t4.u}} +do_catchsql_test 4.5.5 { + CREATE TABLE t5(s, u INT PRIMARY KEY NOT NULL, v); + INSERT INTO t5 VALUES(1, NULL, 2); +} {1 {NOT NULL constraint failed: t5.u}} # EVIDENCE-OF: R-00227-21080 A UNIQUE constraint is similar to a PRIMARY # KEY constraint, except that a single table may have any number of @@ -1288,14 +1308,12 @@ do_createtable_tests 4.6 { 4 "CREATE TABLE t4(a, b, c, UNIQUE(a, b, c))" {} } -# EVIDENCE-OF: R-55240-58877 For each UNIQUE constraint on the table, -# each row must feature a unique combination of values in the columns +# EVIDENCE-OF: R-30981-64168 For each UNIQUE constraint on the table, +# each row must contain a unique combination of values in the columns # identified by the UNIQUE constraint. # -# EVIDENCE-OF: R-47733-51480 If an INSERT or UPDATE statement attempts -# to modify the table content so that two or more rows feature identical -# values in a set of columns that are subject to a UNIQUE constraint, it -# is a constraint violation. +# EVIDENCE-OF: R-59124-61339 Each row in a table with a primary key must +# have a unique combination of values in its primary key columns. # do_execsql_test 4.7.0 { INSERT INTO t1 VALUES(1, 2); @@ -1327,9 +1345,9 @@ do_createtable_tests 4.7.1 -error {UNIQUE constraint failed: %s} { 14 "UPDATE t4 SET a=0, b=0, c=0" {{t4.a, t4.b, t4.c}} } -# EVIDENCE-OF: R-21289-11559 As with PRIMARY KEY constraints, for the -# purposes of UNIQUE constraints NULL values are considered distinct -# from all other values (including other NULLs). +# EVIDENCE-OF: R-00404-17670 For the purposes of UNIQUE constraints, +# NULL values are considered distinct from all other values, including +# other NULLs. # do_createtable_tests 4.8 { 1 "INSERT INTO t1 VALUES(NULL, NULL)" {} @@ -1344,10 +1362,9 @@ do_createtable_tests 4.8 { 9 "UPDATE t4 SET c = NULL" {} } -# EVIDENCE-OF: R-26983-26377 INTEGER PRIMARY KEY columns aside, both -# UNIQUE and PRIMARY KEY constraints are implemented by creating an -# index in the database (in the same way as a "CREATE UNIQUE INDEX" -# statement would). +# EVIDENCE-OF: R-55820-29984 In most cases, UNIQUE and PRIMARY KEY +# constraints are implemented by creating a unique index in the +# database. do_createtable_tests 4.9 -repair drop_all_tables -query { SELECT count(*) FROM sqlite_master WHERE type='index' } { @@ -1358,7 +1375,7 @@ do_createtable_tests 4.9 -repair drop_all_tables -query { 5 "CREATE TABLE t1(a PRIMARY KEY, b, c, UNIQUE(c, b))" 2 } -# EVIDENCE-OF: R-02252-33116 Such an index is used like any other index +# Obsolete: R-02252-33116 Such an index is used like any other index # in the database to optimize queries. # do_execsql_test 4.10.0 { @@ -1695,10 +1712,10 @@ proc is_integer_primary_key {tbl col} { }]] 0 } -# EVIDENCE-OF: R-53738-31673 With one exception, if a table has a -# primary key that consists of a single column, and the declared type of -# that column is "INTEGER" in any mixture of upper and lower case, then -# the column becomes an alias for the rowid. +# EVIDENCE-OF: R-47901-33947 With one exception noted below, if a rowid +# table has a primary key that consists of a single column and the +# declared type of that column is "INTEGER" in any mixture of upper and +# lower case, then the column becomes an alias for the rowid. # # EVIDENCE-OF: R-45951-08347 if the declaration of a column with # declared type "INTEGER" includes an "PRIMARY KEY DESC" clause, it does