feat: add PostgreSQL 18 support#149
Merged
Merged
Conversation
- Add versions/18/ package targeting libpg_query 18.0.0 - Add types/18/ and enums/18/ packages with proto parser pointing to protos/18/ - Fetch protos/18/pg_query.proto from upstream 18.0.0 tag - Update pnpm-workspace.yaml with v18 entries - Update parser/ with v18 exports and build configs (full: 13-18, lts: 15-18) - Update CI workflow with v18 build/test matrix entries - Update scripts (fetch-protos, update-versions-types) for v18 - Update README.md and PUBLISH.md with PG 18 references Note: The full/ package (@libpg-query/parser with deparse, fingerprint, etc.) remains on PG 17 — upgrading it to PG 18 requires wasm_wrapper.c changes for the new API (deparse opts by pointer, new functions like pg_query_summary, pg_query_is_utility_stmt, reworked PL/pgSQL parsing).
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Previously types/18/src and enums/18/src were byte-identical to v17
(build:proto was never run against protos/18/pg_query.proto), so the
published @pgsql/types@pg18 / @pgsql/enums@pg18 packages had the PG 17
AST shape. This regenerates from protos/18/pg_query.proto, picking up:
- new node types: ReturningExpr, ReturningClause, ReturningOption,
ATAlterConstraint, SummaryResult (plus nested Table/Function/
FilterColumn/Context under SummaryResult)
- removed node: SinglePartitionSpec
- new enums: CompareType, ReturningOptionKind, VarReturningType
- removed enum: RowCompareType (subsumed by CompareType)
- field additions on 19 messages, mostly RETURNING OLD/NEW
machinery, application-time period constraints, virtual generated
columns, NOT ENFORCED, and parser location metadata
Nothing has shipped to npm yet for PG 18 (no 18.x on registry for @pgsql/types or @pgsql/enums), and the previous 18.0.1/18.0.2 bumps were paired with stale src/ generated from PG 17. Resetting so the first real PG 18 publish lands as a clean 18.0.0. - types/18: 18.0.2 -> 18.0.0 - enums/18: 18.0.1 -> 18.0.0 - versions/18: 18.0.1 -> 18.0.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds PostgreSQL 18 support targeting the upstream
18.0.0tag from pganalyze/libpg_query.New packages:
versions/18/—@libpg-query/v18withlibpgQueryTag: "18.0.0"types/18/—@libpg-query/types18(proto parser points toprotos/18/pg_query.proto)enums/18/—@libpg-query/enums18(proto parser points toprotos/18/pg_query.proto)protos/18/pg_query.proto— fetched from upstream 18.0.0Config/script updates:
pnpm-workspace.yaml— addedversions/18,types/18,enums/18scripts/fetch-protos.js— added'18'to version listscripts/update-versions-types.js— extended range to include PG 18parser/package.json— added./v18export entriesparser/scripts/prepare.js— updatedfull(13-18) andlts(15-18) build configsparser/test/— updated version arrays and error message assertions for PG 18CI updates:
v18to build-wasm and test matricesbuild-parserandtest-parserjobsREADME updates:
@pgsql/parserdescriptions to mention PG 18 supportNot included (follow-up): The
full/package (@libpg-query/parser) remains on PG 17. Upgrading it requireswasm_wrapper.cchanges for breaking API changes in PG 18 (deparse opts by pointer, new functions likepg_query_summary,pg_query_is_utility_stmt, reworked PL/pgSQL parsing).Review & Testing Checklist for Human
@pgsql/types@pg18, updateversions/18/package.jsondependency from^17.6.2to the appropriate^18.xversionpnpm run build:protointypes/18/andenums/18/to regenerate TS types from the PG 18 proto (the current src files are carried over from v17 and need regeneration)Notes
18.0.0instead of the old17-6.1.0dash-separated format. This is correct — upstream genuinely changed their convention for PG 18.ReturningExprnode type and shifts all subsequentNodeoneof field numberstypes/18/src/andenums/18/src/files are currently the v17-generated TS files — they'll be correct after runningbuild:protoagainst the v18 protoLink to Devin session: https://app.devin.ai/sessions/5d3588c124524869b388ced885962d70
Requested by: @pyramation