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 NULL in BETWEEN #7465

Closed
suyZhong opened this issue Feb 27, 2024 · 1 comment
Closed

Unexpected result when using NULL in BETWEEN #7465

suyZhong opened this issue Feb 27, 2024 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@suyZhong
Copy link

Describe the bug
Consider the test case below. It is unexpected that the third query returns true, since the second query returns null, which means that the WHERE clause in the third query should be evaluated to null and thus return an empty result.

To Reproduce

DROP TABLE t0 CASCADE;
DROP TABLE t1 CASCADE;

CREATE TABLE t1(c0 BOOLEAN);
INSERT INTO t1 (c0) VALUES (true);

SELECT * FROM t1; -- true
SELECT (((t1.c0 NOT IN (true)))=((t1.c0 BETWEEN true AND NULL))) FROM t1; -- null
SELECT * FROM t1 WHERE (((t1.c0 NOT IN (true)))=((t1.c0 BETWEEN true AND NULL))); 
-- Expected: Empty set
-- Actual: true

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: c9e0977) (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: @618e73c727b6 (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 the bug Something isn't working label Feb 28, 2024
@njnes njnes self-assigned this Mar 4, 2024
@njnes njnes added this to the NEXTRELEASE milestone Mar 4, 2024
@njnes
Copy link
Contributor

njnes commented Mar 4, 2024

fixed in dec2023, range comparison was incorrectly optimized

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants