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 after creating partial index #7995

Closed
suyZhong opened this issue Feb 7, 2024 · 2 comments
Closed

Unexpected results after creating partial index #7995

suyZhong opened this issue Feb 7, 2024 · 2 comments

Comments

@suyZhong
Copy link

suyZhong commented Feb 7, 2024

Considering the test case below.

CREATE TABLE t0(c0 BOOLEAN);
CREATE TABLE t1(c0 INT, c1 INTEGER);
CREATE UNIQUE INDEX t1i0 ON t1(c0 ) WHERE ((t1.c0) IS NOT NULL);
INSERT INTO t0 (c0) VALUES (true);
INSERT INTO t0 (c0) VALUES (false);
INSERT INTO t1 (c0, c1) VALUES (0, 1);
INSERT INTO t1 (c0) VALUES (1);
INSERT INTO t1 (c0) VALUES (2);
INSERT INTO t1 (c0) VALUES (3);
INSERT INTO t1 (c0) VALUES (4);
INSERT INTO t1 (c0) VALUES (5);
INSERT INTO t1 (c0) VALUES (6);
INSERT INTO t1 (c0) VALUES (7);
INSERT INTO t1 (c0) VALUES (8);
INSERT INTO t1 (c0) VALUES (9);
INSERT INTO t1 (c0) VALUES (10); -- at least 11 rows data


SELECT ((true OR t1.c1 > 0)AND(t0.c0))  FROM t1, t0; -- 11 rows of true
SELECT * FROM t1, t0 WHERE ((true OR t1.c1 > 0)AND(t0.c0));
-- Expected: 11 rows
-- Actual: empty result

The second SELECT returns an empty result, which is surprising: the WHERE condition is the same as the SELECT condition, and thus the second query should return the same rows as the true in the first query.

I found this in version LI-T6.0.0.249 where I built from source code 36e4d0d.

@dyemanov
Copy link
Member

dyemanov commented Feb 7, 2024

Committed into v5 branch, will be frontported into master after the (successful, hopefully) QA pass.

@pavel-zotov
Copy link

QA note: checked on 5.0.1.1332 (commit ffb5422) -- all fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment