Skip to content

EXPLAIN only outputs an empty plan where there's a plan_err #15598

Closed
@alan910127

Description

@alan910127

Describe the bug

Discovered in #15482.

When a statement causes a plan_err, running EXPLAIN on that statement produces only an empty plan result.

To Reproduce

Run the following statements:

-- Create a table with an INT column
> CREATE TABLE t AS SELECT CAST(123 AS int) a;
0 row(s) fetched.
Elapsed 0.072 seconds.

-- This query triggers a type coercion error
> SELECT * FROM t WHERE a = '9999999999';
type_coercion
caused by
Error during planning: Cannot coerce '9999999999' to type 'Int32'

-- But explain just returns an empty plan
> EXPLAIN SELECT * FROM t WHERE a = '9999999999';
+-----------+------+
| plan_type | plan |
+-----------+------+
+-----------+------+
0 row(s) fetched.
Elapsed 0.004 seconds.

Expected behavior

provide a meaningful error message or indicate that planning failed

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions