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

Expression 'where bool_field IS true | false' should also use index as 'where bool_field = true | false' (if such index exists) [CORE4735] #5041

Closed
firebird-automations opened this issue Apr 4, 2015 · 2 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

SQL> recreate table t(boo boolean);
SQL> commit;
SQL> create index t_boo on t(boo);
SQL> commit;

SQL> set plan on;

SQL> select * from t where boo is null;
PLAN (T INDEX (T_BOO))

SQL> select * from t where boo is not distinct from true;
PLAN (T INDEX (T_BOO))

SQL> select * from t where boo = true;
PLAN (T INDEX (T_BOO))

SQL> select * from t where boo IS true;
PLAN (T NATURAL)

It will be useful if optimizer will also use index in the last expression because for boolean values one may easy to get mistake by typing 'x IS true' instead of 'x = true' -- simply because first case "sounds" more natively in english language when such expression is pronounced.

Commits: ba03a8c FirebirdSQL/fbt-repository@e66b0fd

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 2 [ 10586 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

QA Status: Done successfully

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants