aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <>2024-03-24 21:10:45 +0000
committerdrh <>2024-03-24 21:10:45 +0000
commitcf84ae0189ced4937662feebfcc855d64a5232a1 (patch)
tree5d389cc7aa3c9858ab93f97f6dfc385eaf871b2e /src
parent4a402b80c59d4d3f929544e8eea54e8e5965700a (diff)
downloadsqlite-cf84ae0189ced4937662feebfcc855d64a5232a1.tar.gz
sqlite-cf84ae0189ced4937662feebfcc855d64a5232a1.zip
Fix the xBestIndex method of the pragma virtual table so that it correctly
gives a higher cost to plans where the schema hidden parameter is unconstrained. Fix for the problem reported by [forum:/forumpost/85b6a8b6705fb77a|forum post 85b6a8b6705fb77a]. FossilOrigin-Name: bc516ff5202ee6e9834266bf755fe26e30ac557dcc7975ca7a06dfe33874fcd2
Diffstat (limited to 'src')
-rw-r--r--src/pragma.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pragma.c b/src/pragma.c
index d3b019823..d14428f75 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -2885,7 +2885,11 @@ static int pragmaVtabBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
j = seen[0]-1;
pIdxInfo->aConstraintUsage[j].argvIndex = 1;
pIdxInfo->aConstraintUsage[j].omit = 1;
- if( seen[1]==0 ) return SQLITE_OK;
+ if( seen[1]==0 ){
+ pIdxInfo->estimatedCost = (double)1000;
+ pIdxInfo->estimatedRows = 1000;
+ return SQLITE_OK;
+ }
pIdxInfo->estimatedCost = (double)20;
pIdxInfo->estimatedRows = 20;
j = seen[1]-1;