Wrong result when filtering with correlated subquery

lukaseder
SQL-Fighter

I'm using Exasol 7.0.7. The problem can be reproduced as follows:

CREATE TABLE t (i int);
CREATE TABLE u (i int);

INSERT INTO t VALUES (1);
INSERT INTO u VALUES (1);

SELECT i
FROM t
WHERE 0 = (
  SELECT count(*)
  FROM u
  WHERE t.i = u.i
  AND FALSE
)

The query should return 1, but it yields an empty result set. So does this one:

SELECT i
FROM t
WHERE 0 = (
  SELECT count(*)
  FROM u
  WHERE t.i = u.i
  AND u.i = 2
)

This one works correctly and produces 1 row containing the value 1:

SELECT i
FROM t
WHERE 1 = (
  SELECT count(*)
  FROM u
  WHERE t.i = u.i
)

  

1 ACCEPTED SOLUTION

exa-GeorgD
Team Exasol
Team Exasol

Hi Lukas,

thanks once again for the report.
We already know about this issue it is already part of our roadmap and bugtracker.
It is a bit annoying that we cannot point you to the bug ticket, but at least we can answer you here 😉

Best wishes
Georg

View solution in original post

2 REPLIES 2

exa-GeorgD
Team Exasol
Team Exasol

Hi Lukas,

thanks once again for the report.
We already know about this issue it is already part of our roadmap and bugtracker.
It is a bit annoying that we cannot point you to the bug ticket, but at least we can answer you here 😉

Best wishes
Georg

View solution in original post

lukaseder
SQL-Fighter

Thanks a lot for the feedback. No worries about the bug ticket!