Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VTab BestIndex sets .omit when Used=true #1080

Open
cheezypoofs opened this issue Aug 31, 2022 · 0 comments
Open

VTab BestIndex sets .omit when Used=true #1080

cheezypoofs opened this issue Aug 31, 2022 · 0 comments

Comments

@cheezypoofs
Copy link

https://github.com/mattn/go-sqlite3/blob/master/sqlite3_opt_vtable.go#L467

I'm willing to submit a PR, but wanted to first see if this was viewed as a misinterpretation of the documentation. I got the impression that setting .omit is only for specifying that you will take care of the constraint and you're hinting to sqlite that it can skip the step if it wants.

From: sqlite

it can try to suppress that double-check by setting aConstraintUsage[].omit

I guess I was hoping that one could set .Used = true in order to get hints and receive the right-side values in Filter(), but implement a best-effort filter and not a definite filter.

Would we be open to changing the behavior here to say that .Used = true just means you want to use the constraint and you can still receive it in filter, and we can add a separate .Omit = true to be more explicit about the omit? Or maybe to preserve backward compat with existing behavior we can add something like .UsedNoOmit = true.

Thoughts?

cheezypoofs added a commit to cheezypoofs/go-sqlite3 that referenced this issue Aug 31, 2022
The virtual table omit flag is idenfified by sqlite as an optional
hint you can give the database about whether you are processed the
constraints, but the library doesn't require that you actually do
the filtering. Separting the .Used flag, which tells this go
wrapper to setup arguments to receive the constraints in Filter,
from the Omit flag allows us to inspect and perhaps do a best-effort
filtering and still allow sqlite proper to complete the evaluation
by leaving .omit false.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant