mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
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
This commit is contained in:
@@ -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];
|
||||
|
Reference in New Issue
Block a user