diff options
author | danielk1977 <danielk1977@noemail.net> | 2008-03-17 09:36:44 +0000 |
---|---|---|
committer | danielk1977 <danielk1977@noemail.net> | 2008-03-17 09:36:44 +0000 |
commit | 39359dc0206b11d9fc20c3ffd1a233b101a76cf2 (patch) | |
tree | 9c10498c58411b7b7779df5385c67e702f4bec14 /src/test8.c | |
parent | 17fe6c1d327d3ed7836f6914987023100a33eed2 (diff) | |
download | sqlite-39359dc0206b11d9fc20c3ffd1a233b101a76cf2.tar.gz sqlite-39359dc0206b11d9fc20c3ffd1a233b101a76cf2.zip |
Return an error when an xBestIndex() method indicates that it intends to use the value of an unusable constraint. Related to #2998. (CVS 4867)
FossilOrigin-Name: ffd470279540b1b8e3fdce6eb14001bae489b16d
Diffstat (limited to 'src/test8.c')
-rw-r--r-- | src/test8.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/test8.c b/src/test8.c index 8c49571af..a0749cb22 100644 --- a/src/test8.c +++ b/src/test8.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test8.c,v 1.60 2008/02/13 18:25:27 danielk1977 Exp $ +** $Id: test8.c,v 1.61 2008/03/17 09:36:45 danielk1977 Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -730,6 +730,11 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ int useCost = 0; double cost; + int isIgnoreUsable = 0; + if( Tcl_GetVar(interp, "echo_module_ignore_usable", TCL_GLOBAL_ONLY) ){ + isIgnoreUsable = 1; + } + /* Determine the number of rows in the table and store this value in local ** variable nRow. The 'estimated-cost' of the scan will be the number of ** rows in the table for a linear scan, or the log (base 2) of the @@ -768,6 +773,8 @@ static int echoBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ pConstraint = &pIdxInfo->aConstraint[ii]; pUsage = &pIdxInfo->aConstraintUsage[ii]; + if( !isIgnoreUsable && !pConstraint->usable ) continue; + iCol = pConstraint->iColumn; if( pVtab->aIndex[iCol] ){ char *zCol = pVtab->aCol[iCol]; |