Skip to content

feat: upgrade parser stack to PG18 (pgsql-parser 18.1.1, libpg-query 18.1.2)#1409

Merged
pyramation merged 1 commit into
mainfrom
feat/pg18-parser-stack
Jul 21, 2026
Merged

feat: upgrade parser stack to PG18 (pgsql-parser 18.1.1, libpg-query 18.1.2)#1409
pyramation merged 1 commit into
mainfrom
feat/pg18-parser-stack

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

Moves the monorepo onto the PG18 parser stack (pgsql-parser/pgsql-deparser/@pgsql/* 18.1.x, libpg-query 18.1.2) and fixes the PG18 AST breaking changes:

  • pg-ast: regenerated asts.ts/wrapped.ts from PG18's pg_query.proto (new ReturningClause/ReturningOption/ATAlterConstraint nodes; SinglePartitionSpec/inhcount/rctype removed).
  • query-builder: PG18 renamed returningListreturningClause on Insert/Update/DeleteStmt. _buildReturningList(): unknown[]_buildReturningClause(): { exprs }. Without this, the PG18 deparser silently drops RETURNING — this is the root cause of constructive-db's sync-gateway-route-dispatch CI failure (InvocationTracker.insertRunning got 0 rows back from INSERT ... RETURNING id).
  • graphile-sql-expression-validator: PG18 types make Node a strict union; narrow with 'SelectStmt' in stmt / 'ResTarget' in targetNode before member access.

After merge, pg-ast and @constructive-io/query-builder need publishing so constructive-db (PR constructive-io/constructive-db#2396) can pick up the returningClause fix.

Verified: full build green; query-builder 111, pg-ast, sql-expression-validator 271 tests pass; INSERT ... RETURNING id emits correctly again. The graphile-upload-plugin test failure (graphql GraphQLNamedType typing) reproduces identically on main.

Link to Devin session: https://app.devin.ai/sessions/064ad193e1c040af8c145d55e07af9b8
Requested by: @pyramation

…18.1.2)

- bump pgsql-parser/deparser, plpgsql-*, @pgsql/* deps to the 18.1.x line
- regenerate pg-ast from the PG18 pg_query.proto (returningClause, ReturningOption, ATAlterConstraint, etc.)
- query-builder: emit InsertStmt/UpdateStmt/DeleteStmt returningClause instead of removed returningList
- sql-expression-validator: narrow PG18 Node union before member access
@pyramation pyramation self-assigned this Jul 21, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​pgsql/​quotes@​18.1.07710010087100
Added@​pgsql/​traverse@​18.1.09210010089100
Added@​pgsql/​types@​18.0.010010010093100
Added@​pgsql/​utils@​18.1.19310010095100
Addedpgsql-deparser@​18.1.110010010096100
Addedpgsql-parser@​18.1.11001009796100

View full report

@pyramation
pyramation merged commit d901d40 into main Jul 21, 2026
14 checks passed
@pyramation
pyramation deleted the feat/pg18-parser-stack branch July 21, 2026 23:47
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.

1 participant