feat: PostgreSQL 18 support (libpg-query 18.1.1, @pgsql/types 18)#309
Merged
Conversation
Contributor
🤖 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:
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
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
Upgrades the whole monorepo to PostgreSQL 18:
libpg-query@18.1.1+@pgsql/types@^18.0.0everywhere (SQL side and PL/pgSQL side — the plpgsql packages switch from@libpg-query/parser@17tolibpg-query, whose slim API now includesparsePlPgSQL).Release strategy (no publish in this PR): publish PG18 packages under the
pg18npm dist-tag, keepingpg17aslatestfor now — mirroring the 16→17 rollout.config/versions.jsonadds the 18 entry (libpg-query 18.1.1,pgsql-parser/pgsql-deparser18.0.0,npmTag: pg18).Deparser (pgsql-deparser)
returningList→returningClause: newReturningClause/ReturningOptionvisitors on INSERT/UPDATE/DELETE/MERGE, incl.RETURNING WITH (OLD AS o, NEW AS n).ATAlterConstraintnode:ALTER TABLE ... ALTER CONSTRAINT c [NOT] ENFORCED | [NOT] DEFERRABLE [INITIALLY DEFERRED] | [NO] INHERIT.Constraint:is_enforced(NOT ENFORCED),generated_kind(GENERATED ... VIRTUAL),without_overlaps/pk_with_period/fk_with_period(temporal PK/FK withWITHOUT OVERLAPS/PERIOD),CONSTR_NOTNULL,CONSTR_ATTR_[NOT_]ENFORCED; removed obsoleteAT_CheckNotNull.CreateStmt.nnconstraints,IndexStmt.iswithoutoverlaps, newMergeSupportFunc(merge_action()).VariableSetStmt.jumble_argsused to preserve specialSET TIME ZONE .../SET XML OPTION ...spellings.rexpr_list_start/end,list_start/list_end, …) added to fixture-cleaning utils.Transform (@pgsql/transform)
src/18types/enums,transformers/v17-to-v18.ts, direct transformersv13..v17-to-v18, multi-version registry updated;transformToLatestnow targets 18.returningList→returningClause, wrapsAT_AlterConstraintdefs inATAlterConstraint, and setsjumble_argsforVAR_SET_MULTITRANSACTION forms.MergeWhenClause.matched→matchKind, v13→v14AlterExtensionContentsStmtobjfuncargs handling.SET TIME ZONEfromSET timezone TO) documented inskip-tests/known-issues.ts.PL/pgSQL packages (plpgsql-parser / plpgsql-deparser / plpgsql-parse / parse)
Switched to
libpg-query@18.1.1. PG18's PL/pgSQL serialization changed in ways the deparser now handles:out_param_varnois no longer serialized when0→ newresolveOutParamVarno()(finds the(unnamed row)OUT-param datum, falls back toreturnInfo), soRETURN;/RETURN NEXT;are still suppressed correctly in OUT-param functions.RETURN NEWnow arrives asretvarnoinstead of expr text → deparse emitsRETURN NEW/RETURN OLD(uppercase; source casing is not recoverable).PLpgSQL_recnow carriesdatatype(source-cased, e.g.recordvsRECORD) → declarations preserve it;%rowtype/%typesuffix casing normalized.generated.jsonregenerated: 27 fixtures skipped where PG18 rejects them at parse time (PG18 now validates e.g.RETURN exprin procedures, OUT+VARIADIC, unknown domain-array return types,%type[]); snapshots updated for the casing changes above.Fixture churn categories
__fixtures__/kitchen-sink/misc/pg18.sql, transform 17-18 suites).record-case preservation andRETURN NEW/newcasing.Not supported / known limits
jumble_argsfor specialSET TIME ZONE/SET XML OPTION(info missing from PG17 AST) — documented as known issues.pgsql-typesand@pgsql/clihave no test files (jestexits "No tests found") and repo-widepnpm run lintfails on ESLint 9 vs.eslintrc— both pre-existing onmain, untouched here.Verification
pnpm run buildgreen; all package test suites green: deparser 714, transform 1437, plpgsql-deparser 106, plpgsql-parser 285, plpgsql-parse 57, parse 68, parser 9, quotes 57, traverse 12, utils 4, proto-parser 42.Link to Devin session: https://app.devin.ai/sessions/064ad193e1c040af8c145d55e07af9b8
Requested by: @pyramation