Skip to content

Writes from EXPLAIN ANALYZE are classified as OtherRead #36

@sjones94549

Description

@sjones94549

In postgres and some others, EXPLAIN ANALYZE executes the query it's explaining, which might itself not be a read query. For example:

EXPLAIN ANALYZE DELETE FROM abc;

...will actually delete from the table, but sqlparser classifies it as OtherRead rather than Delete. It's possible this is intentional, as EXPLAIN ANALYZE results in an explanation meant to be read, but it's also unintuitive here, since the underlying query is not a read operation. In the above, not even walking the tree exposes the DELETE part.

I would like a way to verify read-only SELECTs, DESCRIBEs and non-mutating EXPLAINs, but I don't think I can do that simply with a type switch, as OtherRead won't capture the mutating EXPLAIN ANALYZE case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions