Merge pull request #1433 from mattn/fix-vtable-bestindex-usable
Ignore Used for constraints SQLite marked not usable
This commit is contained in:
@@ -463,7 +463,11 @@ func goVBestIndex(pVTab unsafe.Pointer, icp unsafe.Pointer) *C.char {
|
||||
slice := unsafe.Slice(info.aConstraintUsage, int(info.nConstraint))
|
||||
index := 1
|
||||
for i := range slice {
|
||||
if res.Used[i] {
|
||||
// SQLite returns "xBestIndex malfunction" when an argvIndex is
|
||||
// assigned to a constraint it marked as not usable, so ignore
|
||||
// Used for those; they may become usable on a later xBestIndex
|
||||
// invocation for a different plan.
|
||||
if res.Used[i] && csts[i].Usable {
|
||||
slice[i].argvIndex = C.int(index)
|
||||
slice[i].omit = C.uchar(1)
|
||||
index++
|
||||
|
||||
Reference in New Issue
Block a user