Skip to content

= ANY / <> ALL subquery fails to plan: Schema contains duplicate unqualified field name mark #22477

@HairstonE

Description

@HairstonE

Describe the bug

Queries that use ANY / ALL subquery comparisons fail at planning time with an internal schema error instead of executing.

To Reproduce

CREATE TABLE person(id INT, age INT);
  INSERT INTO person VALUES (1, 20), (2, 30), (3, 40);

  -- (1) ANY
  SELECT id FROM person WHERE age = ANY (SELECT age FROM person);

  -- (2) ALL
  SELECT id FROM person WHERE age <> ALL (SELECT age FROM person);

Both queries fail at planning time with:

Optimizer rule 'optimize_projections' failed
caused by
Schema error: Schema contains duplicate unqualified field name mark

Expected behavior

ANY: age = ANY (SELECT age FROM person) is true for every row (each row's age is in the set {20, 30, 40}). Expected output: ids 1, 2, 3.
ALL: age <> ALL (SELECT age FROM person) is false for every row. Expected output: zero rows.

Additional context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions