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 results when using LEFT JOIN with NULL as predicate #1238

Closed
suyZhong opened this issue Jan 19, 2024 · 1 comment
Closed

Unexpected results when using LEFT JOIN with NULL as predicate #1238

suyZhong opened this issue Jan 19, 2024 · 1 comment

Comments

@suyZhong
Copy link

Consider the test case below. It is unexpected that the second query returns NULL, NULL, as the first query returns NULL, 1, and the subsequent queries with WHERE filter shouldn't return any extra row.

DROP TABLE t0;
DROP TABLE t1;

CREATE TABLE t0(c0 VARCHAR(500));
CREATE TABLE t1(c0 INTEGER, c1 INTEGER);
INSERT INTO t1 (c0) VALUES (1);
INSERT INTO t1 (c1) VALUES (2);
INSERT INTO t0 (c0) VALUES ('a');


SELECT t1.c0 FROM t1 LEFT  JOIN t0 ON t1.c1; -- NULL, 1
SELECT t1.c0 FROM t1 LEFT  JOIN t0 ON t1.c1 WHERE (NOT NULL) UNION ALL SELECT t1.c0 FROM t1 LEFT  JOIN t0 ON t1.c1 WHERE ((NULL) IS NULL);
-- Expected: NULL, 1
-- Actual: NULL, NULL

-- This query works as expected
SELECT t1.c0 FROM t1 LEFT  JOIN t0 ON t1.c1 WHERE ((NULL) IS NULL); -- NULL, 1

I build docker image following this: https://github.com/openlink/vos-reference-docker. Kindly inform me if I did something wrong or I should provide more information.

Here's the version:

[vos-reference/develop/7]

This Docker image is using the following version of Virtuoso:

Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.2.12-dev.3238-pthreads as of Jan 19 2024 (b361275)
Compiled for Linux (x86_64-pc-linux-gnu)
Copyright (C) 1998-2024 OpenLink Software
@pkleef pkleef closed this as completed in 1b3242a Feb 6, 2024
@TallTed
Copy link
Collaborator

TallTed commented Feb 6, 2024

We believe we've fixed this in 1b3242a, now in the develop/7 branch.

Please let us know if your testing shows otherwise.

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

No branches or pull requests

2 participants