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

Unexpected result when using AND/OR chain #7448

Closed
suyZhong opened this issue Jan 24, 2024 · 0 comments
Closed

Unexpected result when using AND/OR chain #7448

suyZhong opened this issue Jan 24, 2024 · 0 comments
Assignees
Labels
bug Something isn't working SQL
Milestone

Comments

@suyZhong
Copy link

Describe the bug
Consider the test case below. It is unexpected that the third query returns empty table, since the second query returns true, which means that the WHERE clause of AND OR chain in the third query should be evaluated to true and thus return the row in the table.

To Reproduce

DROP TABLE t0 CASCADE;

CREATE TABLE t0(c0 BOOLEAN,  c1 VARCHAR);
INSERT INTO t0 (c0, c1) VALUES (true, true);
CREATE INDEX i0 ON t0(c1 , c0 );

SELECT * FROM t0; -- true, true
SELECT (t0.c1=(t0.c0 OR true))AND(t0.c0) FROM t0; -- true
SELECT * FROM t0 WHERE ((t0.c1=(t0.c0 OR true))AND(t0.c0));
-- expected: true, true
-- actual: empty table

Expected behavior
As mentioned above

Screenshots
N/A

Software versions
Build from source:

> docker exec monetdb-test mserver5 --version --dbname=monetdb
MonetDB 5 server 11.50.0 (hg id: 25da4f1) (64-bit, 128-bit integers)
This is an unreleased version
Copyright (c) 1993 - July 2008 CWI
Copyright (c) August 2008 - 2023 MonetDB B.V., all rights reserved
Visit https://www.monetdb.org/ for further information
Found 503.5GiB available memory, 128 available cpu cores
Libraries:
Compiled by: @08cc21708292 (x86_64-pc-linux-gnu)
Compilation: /usr/bin/cc 
Linking    : /usr/bin/ld

Issue labeling
Bug

Additional context
Add any other context about the problem here.

@mvdvm mvdvm added bug Something isn't working SQL labels Jan 25, 2024
@njnes njnes self-assigned this Jan 26, 2024
@njnes njnes closed this as completed Jan 26, 2024
monetdb-team pushed a commit that referenced this issue Jan 26, 2024
ranges queries can have null's and not return NULL, ie fixed optimizer/statistics
only use full hash index for selects
@mvdvm mvdvm added this to the NEXTRELEASE milestone Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working SQL
Projects
None yet
Development

No branches or pull requests

4 participants