Skip to content

fix(postgrest-typegen): inline pg-format literal and drop the dependency - #138

Merged
spydon merged 1 commit into
supabase:mainfrom
avallete:fix/postgrest-typegen-inline-pg-format
Sep 2, 2026
Merged

spydon merged 1 commit into
supabase:mainfrom
avallete:fix/postgrest-typegen-inline-pg-format

Conversation

@avallete

@avallete avallete commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Inline a literal() port of [email protected] into packages/postgrest-typegen and drop the pg-format / @types/pg-format dependencies.
  • pg-format is CommonJS-only and its transitive footprint made @supabase/postgrest-typegen painful to consume from ESM/bundled CLIs (supabase/cli). The package only ever used literal().
  • The port keeps pg-format's quoted-number behavior (limit '10') because this package is byte-parity constrained against postgres-meta. It does not adopt packages/pg-meta's unquoted-number variant.

Test plan

  • bun run check-types in packages/postgrest-typegen
  • bun run format-and-lint
  • bun test test/introspection/pg-format.test.ts (8 pass)
  • CI: full postgrest-typegen suite (includes Docker/parity tests)

Made with Cursor

`pg-format` is CommonJS-only and its transitive footprint made it painful to
consume `@supabase/postgrest-typegen` from ESM/bundled CLIs (supabase/cli).
The package only ever used `literal()`, so inline a minimal port of it in
`src/introspection/sql/pg-format.ts` (the same approach `packages/pg-meta`
took in supabase/supabase) and remove `pg-format` + `@types/pg-format`.

The port mirrors `[email protected]` byte-for-byte, including quoting numbers
(`limit '10'`), because postgres-meta emits exactly that and this package is
byte-parity constrained against it. It deliberately does not adopt pg-meta's
unquoted-number variant.

RED (before the helper existed):

    error: Cannot find module '../../src/introspection/sql/pg-format.ts'
    0 pass / 1 fail

GREEN: 100 pass across the Docker-free unit suites; check-types, oxfmt/oxlint,
knip and build all clean.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WvDCziDG3ahaFdo781wyEf
@avallete
avallete requested a review from a team as a code owner September 2, 2026 08:38
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 18f363b3-f2be-4548-a212-ecb7f9bebc66


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@spydon spydon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks!

@spydon
spydon merged commit 2c16a15 into supabase:main Sep 2, 2026
5 checks passed
spydon pushed a commit that referenced this pull request Sep 2, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.2.1](postgrest-typegen-v0.2.0...postgrest-typegen-v0.2.1)
(2026-09-02)


### Bug Fixes

* **postgrest-typegen:** escape database values in Swift string literals
([#123](#123))
([4a5cef5](4a5cef5))
* **postgrest-typegen:** escape Go struct tags for pathological column
names ([#122](#122))
([42c0249](42c0249))
* **postgrest-typegen:** generated columns, NonNullable json, zero-arg
Args, trigger-writable views
([#125](#125))
([67650c6](67650c6))
* **postgrest-typegen:** inline pg-format literal and drop the
dependency ([#138](#138))
([2c16a15](2c16a15))
* **postgrest-typegen:** python escaping, 3.9 imports, JsonValue json
columns, composite nullability
([#124](#124))
([d1f9b3b](d1f9b3b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
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.

3 participants