Add PostgreSQL 19 support - #44
Conversation
Update tree-sitter-postgres to 19.0.0-beta.2 and format the new PG19 syntax across all styles. Features: - SQL/PGQ property graphs: CREATE PROPERTY GRAPH (aligned for the river family, one-per-line for left-aligned styles, deparser-exact for pg_dump) and ALTER PROPERTY GRAPH (ADD ... TABLES reuses the CREATE block layout; short DROP/label forms stay single-line). - GRAPH_TABLE queries laid out as an indented block per style. - FOR PORTION OF (temporal UPDATE/DELETE) preserved. - Window null treatment (RESPECT/IGNORE NULLS) and ordered-set WITHIN GROUP, both previously dropped, now emitted in grammar order. pg_dump fidelity: - CREATE/ALTER PROPERTY GRAPH match pg_dump's actual output (pg_get_propgraphdef body, one element per line, terminated with a semicolon). Test harness: - compose.yaml stands up a throwaway PostgreSQL 19beta2 container that loads tests/fixtures/pg_dump/schema.sql; generate.sh captures the deparser output into the pg_dump idempotency fixtures (replacing the local initdb/pg_ctl path, so only Docker is required). - New fixtures for property graphs, IGNORE NULLS, and WITHIN GROUP. - Dedicated per-style smoke assertions for GRAPH_TABLE, CREATE PROPERTY GRAPH, and ALTER PROPERTY GRAPH. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe formatter now supports PostgreSQL 19 aggregate clauses, temporal UPDATE/DELETE targets, SQL/PGQ graph syntax, and property graph statements. Fixture generation runs against PostgreSQL 19 beta in Docker Compose, with expanded idempotency and smoke-test coverage. ChangesPostgreSQL 19 formatting
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant SQLInput
participant Formatter
participant StyleRenderer
SQLInput->>Formatter: PostgreSQL 19 SQL
Formatter->>StyleRenderer: parsed clauses and graph nodes
StyleRenderer->>SQLInput: formatted SQL for selected style
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@Cargo.toml`:
- Line 14: Update the tree-sitter-postgres dependency requirement in Cargo.toml
to use an exact version constraint for 19.0.0-beta.2, preventing compatible
prerelease updates while preserving the required grammar version.
In `@compose.yaml`:
- Around line 19-20: Update the fixture database port mapping in the Compose
service to bind host port 5599 specifically to 127.0.0.1 while retaining
container port 5432, preventing exposure on all host interfaces.
In `@tests/fixtures/pg_dump/propgraph_min.sql`:
- Around line 1-4: Add propgraph_min.expected for
tests/fixtures/pg_dump/propgraph_min.sql#L1-L4 and propgraph_shop.expected for
tests/fixtures/pg_dump/propgraph_shop.sql#L1-L8, containing the expected
formatted output, and update the fixture assertions to compare each .sql input
against its corresponding .expected file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e4c4cb29-790b-4f28-9ab1-23f2d2616a34
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (14)
Cargo.tomlJustfilecompose.yamlsrc/formatter/expr.rssrc/formatter/pgdump.rssrc/formatter/stmt.rstests/fixtures/pg_dump/generate.shtests/fixtures/pg_dump/propgraph_min.sqltests/fixtures/pg_dump/propgraph_shop.sqltests/fixtures/pg_dump/schema.sqltests/fixtures/pg_dump/view_nulls_win.sqltests/fixtures/pg_dump/view_within_group.sqltests/pgdump_idempotency_test.rstests/smoke_test.rs
- Cargo.toml: use `=19.0.0-beta.2` so a compatible prerelease update cannot silently move the tree-sitter-postgres grammar shape. - compose.yaml: bind the throwaway fixture database to 127.0.0.1 so it is not exposed on all host interfaces with committed credentials. Addresses CodeRabbit review feedback on PR #44. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🤖 This comment was posted by Claude on behalf of @gmr Addressed all CodeRabbit review feedback in d173e80:
All three threads resolved. |
|
🤖 This comment was posted by Claude on behalf of @gmr @coderabbitai review |
|
✅ Action performedReview finished.
|
|
Automated monitoring complete — this PR is ready to merge.
No outstanding review feedback or failing checks. |
Summary
Adds PostgreSQL 19 support: bumps
tree-sitter-postgresto19.0.0-beta.2and formats the new PG19 syntax across all eight styles, with a Docker-based round-trip harness that validates thepg_dumpstyle against genuine deparser output.Features
CREATE PROPERTY GRAPH— column-aligned for the river family (river/aweber/mattmc3), one element per line for the left-aligned styles (dbt/mozilla/gitlab/kickstarter), and byte-for-bytepg_get_propgraphdefforpg_dump.ALTER PROPERTY GRAPH—ADD VERTEX/EDGE TABLESreuses theCREATEblock layout (each clause prefixed withADD); the shortDROP ... TABLESandALTER ... TABLE ... LABELforms stay on one line.GRAPH_TABLEqueries — laid out as an indented block (graph name,MATCH,COLUMNSeach on their own line), anchored to theFROMcontent column for river styles.FOR PORTION OFtemporalUPDATE/DELETEpreserved.RESPECT/IGNORE NULLS) and ordered-setWITHIN GROUP— both were previously dropped; now emitted in grammar order alongsideFILTER/OVER.pg_dump fidelity
CREATE/ALTER PROPERTY GRAPHmatch whatpg_dumpactually emits — thepg_get_propgraphdefbody with one element per line, terminated with a semicolon. Verified against a real PostgreSQL 19beta2 server.Test harness
compose.yamlstands up a throwawaypostgres:19beta2container that loadstests/fixtures/pg_dump/schema.sqlon boot.generate.shcaptures the deparser output into thepg_dumpidempotency fixtures, replacing the previous localinitdb/pg_ctlpath — now only Docker is required (just gen-pgdump-fixtures).IGNORE NULLS, andWITHIN GROUP. The existing 29 view/function fixtures regenerate byte-identical under PG19.GRAPH_TABLE,CREATE PROPERTY GRAPH, andALTER PROPERTY GRAPH(table-driven, exact-match, with idempotency checks on the multi-line blocks).Notes
->/|are SQL/PGQ path/label operators, and operators are formatted generically (verbatim passthrough) so they are style-independent.:label shorthand ((a:Person)) is rejected by PG19 itself — only(a IS Person)is valid, which formats cleanly.Test plan
cargo test— full suite green (smoke suite 23 tests)cargo clippy --all-targets -- -D warningscleancargo fmt --checkcleanjust gen-pgdump-fixturesreproduces committed fixtures byte-for-byte🤖 Generated with Claude Code
Summary by CodeRabbit
UPDATE/DELETE ... FOR PORTION OF ...targets (including optionalFROM ... TO ...forms).FILTER/WITHIN GROUP/RESPECT|IGNORE NULLSalongsideOVER.