Skip to content

Add EXPLAIN with randomized options for Postgres - #1315

Merged
mrigger merged 2 commits into
mainfrom
fix/postgres-explain-generic-plan
Apr 7, 2026
Merged

Add EXPLAIN with randomized options for Postgres#1315
mrigger merged 2 commits into
mainfrom
fix/postgres-explain-generic-plan

Conversation

@mrigger

@mrigger mrigger commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an EXPLAIN action to the Postgres provider that generates EXPLAIN statements with randomized options (ANALYZE, GENERIC_PLAN, FORMAT, VERBOSE, COSTS, BUFFERS, TIMING, SUMMARY)
  • Based on Adding Generic Plan for EXPLAIN in Postgres V16 Upgrade #1265, reimplemented with the following bugs fixed:
    • Invalid SQL syntax: options were each wrapped in separate parentheses (EXPLAIN (ANALYZE) (FORMAT JSON) ...) instead of a single comma-separated list (EXPLAIN (ANALYZE, FORMAT JSON) ...)
    • BUFFERS/TIMING without ANALYZE: these options require ANALYZE to be enabled
    • GENERIC_PLAN + ANALYZE conflict: these are mutually exclusive in PostgreSQL
  • Does not include the unrelated FORCE_PARALLEL_MODE change from Adding Generic Plan for EXPLAIN in Postgres V16 Upgrade #1265

Closes #1044 point 3

Test plan

  • mvn package builds successfully
  • Ran SQLancer against PostgreSQL 18 in Docker (2 threads, 180s, 1600+ queries) with no errors

🤖 Generated with Claude Code

mrigger and others added 2 commits April 6, 2026 09:53
Based on PR #1265, which adds GENERIC_PLAN support for EXPLAIN.
This reimplements the feature with the following bugs fixed:

- EXPLAIN options were each wrapped in separate parentheses
  (e.g. EXPLAIN (ANALYZE) (FORMAT JSON) ...) instead of a single
  comma-separated list (EXPLAIN (ANALYZE, FORMAT JSON) ...)
- BUFFERS and TIMING were generated without ANALYZE, which is required
- GENERIC_PLAN and ANALYZE were not treated as mutually exclusive

Closes #1044 point 3

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…T NULL

When a multi-action ALTER TABLE combines ADD CONSTRAINT ... PRIMARY KEY
with ALTER ... DROP NOT NULL, PostgreSQL returns "primary key column is
not marked NOT NULL". Add this to expected errors in both
ADD_TABLE_CONSTRAINT and ADD_TABLE_CONSTRAINT_USING_INDEX cases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mrigger
mrigger merged commit 6577538 into main Apr 7, 2026
17 of 27 checks passed
@mrigger
mrigger deleted the fix/postgres-explain-generic-plan branch April 7, 2026 15:29
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.

Add support for Postgres v16

1 participant