mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Back out the SQLITE_OMIT_UNIQUE_ENFORCEMENT compile-option. It is an unneeded
complication. FossilOrigin-Name: 927e955b93e869727c55b784401de3ea07bee257
This commit is contained in:
17
manifest
17
manifest
@@ -1,5 +1,5 @@
|
|||||||
C When\sATTACH-ing\sa\snew\sdatabase\sto\san\sexisting\sdatabase\swith\sa\scodec,\sdo\nnot\senable\sthe\scodec\sin\sthe\sattached\sdatabase\sif\sit\sis\snot\senabled\sin\sthe\nexisting\sdatabase\sand\sit\sis\snot\srequested\sby\sthe\sUSING\sclause.
|
C Back\sout\sthe\sSQLITE_OMIT_UNIQUE_ENFORCEMENT\scompile-option.\s\sIt\sis\san\sunneeded\ncomplication.
|
||||||
D 2011-04-09T02:34:33.149
|
D 2011-04-09T03:04:13.095
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2
|
F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -127,7 +127,7 @@ F src/btreeInt.h 67978c014fa4f7cc874032dd3aacadd8db656bc3
|
|||||||
F src/build.c b7c993274ee2a029937b0bc4815bdef80b330017
|
F src/build.c b7c993274ee2a029937b0bc4815bdef80b330017
|
||||||
F src/callback.c 0425c6320730e6d3981acfb9202c1bed9016ad1a
|
F src/callback.c 0425c6320730e6d3981acfb9202c1bed9016ad1a
|
||||||
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
F src/complete.c dc1d136c0feee03c2f7550bafc0d29075e36deac
|
||||||
F src/ctime.c 52ff72f966cee3087e0138a3ec69371c22be3c01
|
F src/ctime.c 7deec4534f3b5a0c3b4a4cbadf809d321f64f9c4
|
||||||
F src/date.c 1548fdac51377e4e7833251de878b4058c148e1b
|
F src/date.c 1548fdac51377e4e7833251de878b4058c148e1b
|
||||||
F src/delete.c 7a24fcc9a31664d145acb97ce56b6d9f249a25e4
|
F src/delete.c 7a24fcc9a31664d145acb97ce56b6d9f249a25e4
|
||||||
F src/expr.c e3cf0957c6b8faaaf7386a3bc69e53c0dc9705be
|
F src/expr.c e3cf0957c6b8faaaf7386a3bc69e53c0dc9705be
|
||||||
@@ -138,7 +138,7 @@ F src/global.c 02335177cf6946fe5525c6f0755cf181140debf3
|
|||||||
F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af
|
F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af
|
||||||
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
|
F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970
|
||||||
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08
|
||||||
F src/insert.c 6873a0b359e538d0568a8b459ca630edef8dde2c
|
F src/insert.c acfb89fe4a73d703e425e167bfcc72985f4299ae
|
||||||
F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
|
F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
|
||||||
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
|
F src/legacy.c a199d7683d60cef73089e892409113e69c23a99f
|
||||||
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
|
F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
|
||||||
@@ -198,7 +198,7 @@ F src/test_async.c 0612a752896fad42d55c3999a5122af10dcf22ad
|
|||||||
F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e
|
F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e
|
||||||
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
|
F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de
|
||||||
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
|
F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2
|
||||||
F src/test_config.c 8f9599650fcd896f62a17be226ae3e439debb5e4
|
F src/test_config.c d536042f27226b4639f0f87d4795fd37428a9ddf
|
||||||
F src/test_demovfs.c 31050680fa6925b4f677cfd4fa965b5f19195e50
|
F src/test_demovfs.c 31050680fa6925b4f677cfd4fa965b5f19195e50
|
||||||
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
F src/test_devsym.c e7498904e72ba7491d142d5c83b476c4e76993bc
|
||||||
F src/test_func.c cbdec5cededa0761daedde5baf06004a9bf416b5
|
F src/test_func.c cbdec5cededa0761daedde5baf06004a9bf416b5
|
||||||
@@ -593,7 +593,6 @@ F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db
|
|||||||
F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a
|
F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a
|
||||||
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
|
F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
|
||||||
F test/null.test a8b09b8ed87852742343b33441a9240022108993
|
F test/null.test a8b09b8ed87852742343b33441a9240022108993
|
||||||
F test/omitunique.test bbb2ec4345d9125d9ee21cd9488d97a163020d5f
|
|
||||||
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
|
F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
|
||||||
F test/oserror.test 498d8337e9d15543eb7b004fef8594bf204ff43c
|
F test/oserror.test 498d8337e9d15543eb7b004fef8594bf204ff43c
|
||||||
F test/pager1.test d8672fd0af5f4f9b99b06283d00f01547809bebe
|
F test/pager1.test d8672fd0af5f4f9b99b06283d00f01547809bebe
|
||||||
@@ -927,7 +926,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
|
|||||||
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
|
||||||
F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
|
F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
P 0ca8a2332b28d88585dc890e5162b095e783fc20
|
P 4caa5fc86e7fe404cd188713277f2801cd02dbc9
|
||||||
R b19292a0a4e4c797c8f7e19da3cea01c
|
R 7c13920af52add3fb4004361c1b744b2
|
||||||
U drh
|
U drh
|
||||||
Z 6219854df534fe7fd4126ed86b170468
|
Z f0a05ecbdcea6caa1b19a9a2e8b6f008
|
||||||
|
@@ -1 +1 @@
|
|||||||
4caa5fc86e7fe404cd188713277f2801cd02dbc9
|
927e955b93e869727c55b784401de3ea07bee257
|
@@ -302,9 +302,6 @@ static const char * const azCompileOpt[] = {
|
|||||||
#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
|
#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION
|
||||||
"OMIT_TRUNCATE_OPTIMIZATION",
|
"OMIT_TRUNCATE_OPTIMIZATION",
|
||||||
#endif
|
#endif
|
||||||
#ifdef SQLITE_OMIT_UNIQUE_ENFORCEMENT
|
|
||||||
"OMIT_UNIQUE_ENFORCEMENT",
|
|
||||||
#endif
|
|
||||||
#ifdef SQLITE_OMIT_UTF16
|
#ifdef SQLITE_OMIT_UTF16
|
||||||
"OMIT_UTF16",
|
"OMIT_UTF16",
|
||||||
#endif
|
#endif
|
||||||
|
@@ -1312,9 +1312,8 @@ void sqlite3GenerateConstraintChecks(
|
|||||||
*/
|
*/
|
||||||
for(iCur=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, iCur++){
|
for(iCur=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, iCur++){
|
||||||
int regIdx;
|
int regIdx;
|
||||||
#ifndef SQLITE_OMIT_UNIQUE_ENFORCEMENT
|
|
||||||
int regR;
|
int regR;
|
||||||
#endif
|
|
||||||
if( aRegIdx[iCur]==0 ) continue; /* Skip unused indices */
|
if( aRegIdx[iCur]==0 ) continue; /* Skip unused indices */
|
||||||
|
|
||||||
/* Create a key for accessing the index entry */
|
/* Create a key for accessing the index entry */
|
||||||
@@ -1332,11 +1331,6 @@ void sqlite3GenerateConstraintChecks(
|
|||||||
sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v, pIdx), P4_TRANSIENT);
|
sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v, pIdx), P4_TRANSIENT);
|
||||||
sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn+1);
|
sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn+1);
|
||||||
|
|
||||||
#ifdef SQLITE_OMIT_UNIQUE_ENFORCEMENT
|
|
||||||
sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn+1);
|
|
||||||
continue; /* Treat pIdx as if it is not a UNIQUE index */
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* Find out what action to take in case there is an indexing conflict */
|
/* Find out what action to take in case there is an indexing conflict */
|
||||||
onError = pIdx->onError;
|
onError = pIdx->onError;
|
||||||
if( onError==OE_None ){
|
if( onError==OE_None ){
|
||||||
@@ -1410,7 +1404,6 @@ void sqlite3GenerateConstraintChecks(
|
|||||||
}
|
}
|
||||||
sqlite3VdbeJumpHere(v, j3);
|
sqlite3VdbeJumpHere(v, j3);
|
||||||
sqlite3ReleaseTempReg(pParse, regR);
|
sqlite3ReleaseTempReg(pParse, regR);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pbMayReplace ){
|
if( pbMayReplace ){
|
||||||
|
@@ -481,12 +481,6 @@ Tcl_SetVar2(interp, "sqlite_options", "long_double",
|
|||||||
Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "truncate_opt", "1", TCL_GLOBAL_ONLY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SQLITE_OMIT_UNIQUE_ENFORCEMENT
|
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "unique_enforcement", "0", TCL_GLOBAL_ONLY);
|
|
||||||
#else
|
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "unique_enforcement", "1", TCL_GLOBAL_ONLY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SQLITE_OMIT_UTF16
|
#ifdef SQLITE_OMIT_UTF16
|
||||||
Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
|
Tcl_SetVar2(interp, "sqlite_options", "utf16", "0", TCL_GLOBAL_ONLY);
|
||||||
#else
|
#else
|
||||||
|
@@ -1,170 +0,0 @@
|
|||||||
# 2011 March 10
|
|
||||||
#
|
|
||||||
# The author disclaims copyright to this source code. In place of
|
|
||||||
# a legal notice, here is a blessing:
|
|
||||||
#
|
|
||||||
# May you do good and not evil.
|
|
||||||
# May you find forgiveness for yourself and forgive others.
|
|
||||||
# May you share freely, never taking more than you give.
|
|
||||||
#
|
|
||||||
#***********************************************************************
|
|
||||||
# This file implements regression tests for SQLite library. The
|
|
||||||
# focus of this file is testing the SQLITE_OMIT_UNIQUE_ENFORCEMENT
|
|
||||||
# compiler option.
|
|
||||||
#
|
|
||||||
|
|
||||||
set testdir [file dirname $argv0]
|
|
||||||
source $testdir/tester.tcl
|
|
||||||
|
|
||||||
set uniq_enforced 1
|
|
||||||
ifcapable !unique_enforcement {
|
|
||||||
set uniq_enforced 0
|
|
||||||
}
|
|
||||||
|
|
||||||
# table with UNIQUE keyword on column
|
|
||||||
do_test omitunique-1.1 {
|
|
||||||
catchsql { CREATE TABLE t1(a TEXT UNIQUE); }
|
|
||||||
} {0 {}}
|
|
||||||
|
|
||||||
# table with UNIQUE clause on column
|
|
||||||
do_test omitunique-1.2 {
|
|
||||||
catchsql { CREATE TABLE t2(a TEXT, UNIQUE(a)); }
|
|
||||||
} {0 {}}
|
|
||||||
|
|
||||||
# table with UNIQUE index on column
|
|
||||||
do_test omitunique-1.3 {
|
|
||||||
catchsql {
|
|
||||||
CREATE TABLE t3(a TEXT);
|
|
||||||
CREATE UNIQUE INDEX t3a ON t3(a);
|
|
||||||
}
|
|
||||||
} {0 {}}
|
|
||||||
|
|
||||||
# table with regular index on column
|
|
||||||
do_test omitunique-1.4 {
|
|
||||||
catchsql {
|
|
||||||
CREATE TABLE t4(a TEXT);
|
|
||||||
CREATE INDEX t4a ON t4(a);
|
|
||||||
}
|
|
||||||
} {0 {}}
|
|
||||||
|
|
||||||
# table with no index on column
|
|
||||||
do_test omitunique-1.5 {
|
|
||||||
catchsql { CREATE TABLE t5(a TEXT); }
|
|
||||||
} {0 {}}
|
|
||||||
|
|
||||||
# run our tests using several table/index forms
|
|
||||||
foreach {j tbl uniq cnt qp_est stat_enforce stat_omit } {
|
|
||||||
1 {t1} 1 1 1 {2 1} {9 9}
|
|
||||||
2 {t2} 1 1 1 {2 1} {9 9}
|
|
||||||
3 {t3} 1 1 1 {2 1} {9 9}
|
|
||||||
4 {t4} 0 9 10 {9 9} {9 9}
|
|
||||||
5 {t5} 0 9 100000 9 9
|
|
||||||
} {
|
|
||||||
|
|
||||||
do_test omitunique-2.0.$j.1 {
|
|
||||||
catchsql [ subst {INSERT INTO $tbl (a) VALUES('abc'); }]
|
|
||||||
} {0 {}}
|
|
||||||
do_test omitunique-2.0.$j.2 {
|
|
||||||
catchsql [ subst {INSERT INTO $tbl (a) VALUES('123'); }]
|
|
||||||
} {0 {}}
|
|
||||||
|
|
||||||
# check various INSERT commands
|
|
||||||
foreach {i cmd err} {
|
|
||||||
1 {INSERT} 1
|
|
||||||
2 {INSERT OR IGNORE} 0
|
|
||||||
3 {INSERT OR REPLACE} 0
|
|
||||||
4 {REPLACE} 0
|
|
||||||
5 {INSERT OR FAIL} 1
|
|
||||||
6 {INSERT OR ABORT} 1
|
|
||||||
7 {INSERT OR ROLLBACK} 1
|
|
||||||
} {
|
|
||||||
|
|
||||||
ifcapable explain {
|
|
||||||
set x [execsql [ subst { EXPLAIN $cmd INTO $tbl (a) VALUES('abc'); }]]
|
|
||||||
ifcapable unique_enforcement {
|
|
||||||
do_test omitunique-2.1.$j.$i.1 {
|
|
||||||
regexp { IsUnique } $x
|
|
||||||
} $uniq
|
|
||||||
}
|
|
||||||
ifcapable !unique_enforcement {
|
|
||||||
do_test omitunique-2.1.$j.$i.1 {
|
|
||||||
regexp { IsUnique } $x
|
|
||||||
} {0}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if { $uniq_enforced==0 || $uniq==0 || $err==0 } {
|
|
||||||
set msg {0 {}}
|
|
||||||
} {
|
|
||||||
set msg {1 {column a is not unique}}
|
|
||||||
}
|
|
||||||
do_test omitunique-2.1.$j.$i.3 {
|
|
||||||
catchsql [ subst {$cmd INTO $tbl (a) VALUES('abc'); }]
|
|
||||||
} $msg
|
|
||||||
|
|
||||||
}
|
|
||||||
# end foreach cmd
|
|
||||||
|
|
||||||
# check UPDATE command
|
|
||||||
ifcapable explain {
|
|
||||||
set x [execsql [ subst { EXPLAIN UPDATE $tbl SET a='abc'; }]]
|
|
||||||
ifcapable unique_enforcement {
|
|
||||||
do_test omitunique-2.2.$j.1 {
|
|
||||||
regexp { IsUnique } $x
|
|
||||||
} $uniq
|
|
||||||
}
|
|
||||||
ifcapable !unique_enforcement {
|
|
||||||
do_test omitunique-2.2.$j.1 {
|
|
||||||
regexp { IsUnique } $x
|
|
||||||
} {0}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if { $uniq_enforced==0 || $uniq==0 } {
|
|
||||||
set msg {0 {}}
|
|
||||||
} {
|
|
||||||
set msg {1 {column a is not unique}}
|
|
||||||
}
|
|
||||||
do_test omitunique-2.2.$j.3 {
|
|
||||||
catchsql [ subst { UPDATE $tbl SET a='abc'; }]
|
|
||||||
} $msg
|
|
||||||
|
|
||||||
# check record counts
|
|
||||||
do_test omitunique-2.3.$j {
|
|
||||||
execsql [ subst { SELECT count(*) FROM $tbl WHERE a='abc'; }]
|
|
||||||
} $cnt
|
|
||||||
|
|
||||||
# make sure the query planner row estimate not affected because of omit enforcement
|
|
||||||
ifcapable explain {
|
|
||||||
do_test omitunique-2.4.$j {
|
|
||||||
set x [ execsql [ subst { EXPLAIN QUERY PLAN SELECT count(*) FROM $tbl WHERE a='abc'; }]]
|
|
||||||
set y [ subst {~$qp_est row} ]
|
|
||||||
regexp $y $x
|
|
||||||
} {1}
|
|
||||||
}
|
|
||||||
|
|
||||||
# make sure we omit extra OP_Next opcodes when the UNIQUE constraints
|
|
||||||
# mean there will only be a single pass through the code
|
|
||||||
ifcapable explain {
|
|
||||||
set x [execsql [ subst { EXPLAIN SELECT * FROM $tbl WHERE a='abc'; }]]
|
|
||||||
do_test omitunique-2.5.$j {
|
|
||||||
if { [ regexp { Next } $x ] } { expr { 0 } } { expr { 1 } }
|
|
||||||
} $uniq
|
|
||||||
}
|
|
||||||
|
|
||||||
# make sure analyze index stats correct
|
|
||||||
ifcapable analyze {
|
|
||||||
if { $uniq_enforced==0 } {
|
|
||||||
set msg [ list $stat_omit ]
|
|
||||||
} {
|
|
||||||
set msg [ list $stat_enforce ]
|
|
||||||
}
|
|
||||||
do_test omitunique-2.6.$j {
|
|
||||||
execsql [ subst { ANALYZE $tbl; } ]
|
|
||||||
execsql [ subst { SELECT stat FROM sqlite_stat1 WHERE tbl='$tbl'; } ]
|
|
||||||
} $msg
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
# end foreach tbl
|
|
||||||
|
|
||||||
finish_test
|
|
Reference in New Issue
Block a user