Skip to content

Unexpected results after creating partial index #7995

@suyZhong

Description

@suyZhong

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions