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.
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:
Given that optd already has
JoinType::Single, we should use this join type for the dependent join generated when converting scalar subqueries.