feat: create @pgsql/quotes package for PostgreSQL identifier quoting and keyword classification#284
Merged
pyramation merged 3 commits intomainfrom Mar 4, 2026
Merged
Conversation
…and keyword classification - Extract QuoteUtils class and kwlist from pgsql-deparser into standalone @pgsql/quotes package - Include keyword generator script for syncing with PostgreSQL kwlist.h - Add comprehensive test suite (57 tests) - Update deparser to depend on @pgsql/quotes and re-export for backwards compatibility
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:
|
The canonical keywords generator now lives in packages/quotes/scripts/keywords.ts. The deparser's copy is left unchanged as legacy convenience.
- Deparser now imports QuoteUtils directly from @pgsql/quotes (no re-export wrappers) - Removed deparser's kwlist.ts, quote-utils.ts shim files - Removed deparser's scripts/keywords.ts (canonical generator is in quotes package) - Removed 'keywords' script entry from deparser package.json
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.
feat: extract @pgsql/quotes package from deparser
Summary
Extracts
QuoteUtilsand the PostgreSQL keyword list (kwlist) frompgsql-deparserinto a new standalone@pgsql/quotespackage. This makes PostgreSQL identifier quoting and keyword classification available without pulling in the entire deparser — useful for migration tools, ORMs, query builders, schema generators, etc.New package (
packages/quotes/):src/kwlist.ts— PG17 keyword list withkeywordKindOf()and pre-builtSetexportssrc/quote-utils.ts—QuoteUtilsclass (faithful port of PG'squote_identifier()fromruleutils.c)scripts/keywords.ts— canonical generator to re-sync from PostgreSQL'skwlist.hDeparser changes:
@pgsql/quotes: workspace:*as a dependencysrc/deparser.tsandsrc/index.tsnow importQuoteUtilsdirectly from@pgsql/quotessrc/kwlist.ts,src/utils/quote-utils.ts, andscripts/keywords.tsfrom the deparser — these now live exclusively in@pgsql/quoteskeywordsnpm script from deparser'spackage.jsonReview & Testing Checklist for Human
src/kwlist.ts,src/utils/quote-utils.ts, andscripts/keywords.tswere removed from the deparser. The deparser's public API (index.ts) still re-exportsQuoteUtilsfrom@pgsql/quotes, but anything that imported those internal files by path will break. Grep the version-specific deparser packages and any other consumers.17.0.1is correct for@pgsql/quotesand aligns with the monorepo's versioning strategypublishConfig.access: "public"is intended for the@pgsql/quotesscopepnpm-lock.yamldiff is large but mostly pnpm quoting-style reformatting — spot-check that no unintended dependency changes snuck inSuggested test plan:
pnpm --filter @pgsql/quotes test— 57 tests for the new packagepnpm --filter pgsql-deparser test— the deparser has 29 pre-existing failures onmain(snapshot drift), unrelated to this PR; confirm no new failurespnpm build— full workspace build to verify all packages compile cleanlyNotes