Skip to content

EXCEPT against a known-empty table is not simplified #1451

Description

@chen8908917

Description

Subtracting a known-empty relation cannot remove any row. Because EXCEPT
has set semantics, the result is equivalent to the distinct rows from
rift_a.

Expected: remove the empty right-hand input and generate a plan equivalent to
SELECT DISTINCT id FROM rift_a.

Actual: the generated plan retains the set-difference processing and access
to rift_empty.

How to repeat

CREATE TABLE rift_empty (id INTEGER);

EXPLAIN ('SELECT id FROM rift_a EXCEPT SELECT id FROM rift_empty');
EXPLAIN ('SELECT DISTINCT id FROM rift_a');

Version

Virtuoso Open Source Server 07.20.3240; Virtuoso ODBC Driver 07.20.3243;
Windows x64 client; WSL2 Docker server.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions