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 for INNER JOIN with IS NOT NULL #7426

Closed
suyZhong opened this issue Jan 2, 2024 · 2 comments
Closed

Unexpected result for INNER JOIN with IS NOT NULL #7426

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

Comments

@suyZhong
Copy link

suyZhong commented Jan 2, 2024

Describe the bug

Consider the test cases below. It is unexpected that the third query returns empty result, since the second query returns true, which means that the WHERE clause in the third query should be evaluated to true and thus return the row in the table.

To Reproduce

CREATE TABLE t1(c1 INTEGER);
CREATE TABLE t0(c0 BOOL, c1 INTEGER);
INSERT INTO t1 (c1) VALUES (0);
CREATE UNIQUE INDEX i0 ON t0(c1 , c0 );
INSERT INTO t0 (c0, c1) VALUES (true, 0);

SELECT t0.c0, t0.c1, t1.c1 FROM t1 INNER  JOIN t0 ON t0.c0; -- true 0 0

SELECT (t0.c1) IS NOT NULL FROM t1 INNER  JOIN t0 ON t0.c0; -- true
SELECT t0.c0, t0.c1, t1.c1 FROM t1 INNER  JOIN t0 ON t0.c0 WHERE (t0.c1) IS NOT NULL; 
-- Expected: true 0 0
-- Actual: Empty Result

Expected behavior
The result of the third query should be same as the first one

Software versions

  • MonetDB v11.49.1 (Dec2023).
  • OS and version: Docker on Ubuntu 22.04
  • Installed from latest docker image

**Issue labeling **
Bug

@sjoerdmullender
Copy link
Member

It seems the UNIQUE INDEX messes things up. Without it, the results are correct.

@sjoerdmullender sjoerdmullender added bug Something isn't working SQL labels Jan 2, 2024
@njnes njnes added this to the NEXTRELEASE milestone Jan 9, 2024
@njnes njnes self-assigned this Jan 9, 2024
@njnes
Copy link
Contributor

njnes commented Jan 9, 2024

Pushed a fix to the dec release

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

3 participants