Skip to content

Add SingleJoin for safety #70

@yliang412

Description

@yliang412

Problem

Scalar subqueries have stricter semantics than ordinary joins: they must return at most one row for each outer row. If a scalar subquery returns more than one row, the query should fail rather than produce duplicated or arbitrary results.

Today, scalar subquery comparisons can be lowered to an inner dependent join:

SELECT *
FROM t
WHERE t.a = (
  SELECT u.a
  FROM u
);

Given that optd already has JoinType::Single, we should use this join type for the dependent join generated when converting scalar subqueries.

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions