-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
CASE WHEN logical expression not short circuiting properly #2685
Comments
I'm not sure short-circuiting is a standard behavior in ANSI SQL, but I've tried PostgreSQL/SQLite of which both produce proper and consistent short-circuiting result. |
Thanks for the report! Not sure about the SQL standard either, but short circuiting should happen. Will have a look. |
Mytherin
added a commit
to Mytherin/duckdb
that referenced
this issue
Nov 29, 2021
…issues, and expose disabled_optimizers to SQL layer as a setting
Mytherin
added a commit
that referenced
this issue
Nov 30, 2021
Fix #2685: prevent CSE optimizer from causing short-circuiting issues, and add disable_optimizers setting
Thanks Mytherin! We can confirm this patch works in our situation. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What happens?
Logical expression in
CASE WHEN
is not short circuiting properly. For exampleCASE WHEN a AND b
,b
is also evaluated whena
is FALSE.To Reproduce
The above code gets an error:
But if delete one
WHEN
statement, a correct result could be yield:Result:
Environment (please complete the following information):
Before Submitting
master
branch?pip install duckdb --upgrade --pre
install.packages("https://github.com/duckdb/duckdb/releases/download/master-builds/duckdb_r_src.tar.gz", repos = NULL)
The text was updated successfully, but these errors were encountered: