Skip to content

subquery_to_derived duplicate name #69

@liyunfan1223

Description

@liyunfan1223

With optimizer_switch='subquery_to_derived=on', running the reproducer below on a freshly created schema crashes the server process. The query was expected to return a result set (or at worst a query-level error) without affecting the server, but instead the server crashes. With subquery_to_derived=off the same query runs fine.

Crash SQL

CREATE TABLE t1 (a BIGINT PRIMARY KEY, b BIGINT);
CREATE TABLE t2 (a BIGINT PRIMARY KEY);

SELECT /*+ SET_VAR(optimizer_switch='subquery_to_derived=on') */
       COUNT(DISTINCT s.a) = (SELECT COUNT(DISTINCT s1.a)
                              FROM t2 s1 WHERE s1.a = o.b) AS x
FROM t1 o LEFT JOIN t2 s ON o.b = s.a
GROUP BY o.a, o.b;

Metadata

Metadata

Assignees

No one assigned

    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