Skip to content

fix(parser): parse EXPLAIN EXECUTE for prepared statements - #2951

Merged
manticore-projects merged 1 commit into
JSQLParser:masterfrom
hutiefang76:frank/fix-jsqlparser2804-explain-execute-20261121
Nov 22, 2026
Merged

manticore-projects merged 1 commit into
JSQLParser:masterfrom
hutiefang76:frank/fix-jsqlparser2804-explain-execute-20261121

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

Refs #2804.

DuckDB and PostgreSQL accept EXPLAIN EXECUTE q for a prepared statement. JSqlParser rejected this form because its EXPLAIN target only accepted queries and DML.

The parser now reuses the existing Execute node for this target in the default and PostgreSQL modes. It round-trips arguments and existing EXPLAIN options. MySQL still interprets EXPLAIN EXECUTE q as a table and column, and bare EXPLAIN EXECUTE still describes a table in the default mode.

I verified both prepared-statement forms with a local DuckDB 1.5.6 CLI. Five new positive regressions failed on the original grammar and passed with this change. The full Gradle check passed with 16,661 tests executed, 25 skipped, and zero JavaCC choice conflicts.

The repository's JMH workload averaged 13.88 ms/op on the baseline and 14.05 ms/op with the patch, with overlapping confidence intervals across three forks each.

DeepSeek assisted with implementation and the first review. The parser, database, and test results are from local runs.

@manticore-projects
manticore-projects merged commit 32d0042 into JSQLParser:master Nov 22, 2026
10 checks passed
@manticore-projects

Copy link
Copy Markdown
Contributor

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants