Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Writes from EXPLAIN ANALYZE are classified as OtherRead #36

Open
sjones94549 opened this issue May 17, 2023 · 0 comments
Open

Writes from EXPLAIN ANALYZE are classified as OtherRead #36

sjones94549 opened this issue May 17, 2023 · 0 comments

Comments

@sjones94549
Copy link

sjones94549 commented May 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant