Skip to content

fix: schema-lint red on main β€” dump carried PG17-only SQL (MAINTAIN, supabase_vault) - #9

Closed
Suydev wants to merge 1 commit into
mainfrom
claude/fix-schema-lint-pg16-e9c0afa33afdc0a3374f9ada7efebc60
Closed

Suydev wants to merge 1 commit into
mainfrom
claude/fix-schema-lint-pg16-e9c0afa33afdc0a3374f9ada7efebc60

Conversation

@Suydev

@Suydev Suydev commented Sep 8, 2026

Copy link
Copy Markdown
Owner

What was broken

The SQL Schema Validation (schema-lint) workflow was red on main. isotope-complete.sql had been regenerated from the hosted Supabase project, which now runs PostgreSQL 17, so the dump carried two constructs that stock PostgreSQL 16 β€” the version pinned by the CI shim and used by fresh self-hosted installs β€” cannot execute:

  • CREATE EXTENSION "supabase_vault" β€” a Supabase-managed extension absent from stock Postgres of any version (extension "supabase_vault" is not available). Nothing in the schema references vault.*.
  • 126Γ— GRANT MAINTAIN ON TABLE ... β€” MAINTAIN is a PostgreSQL 17 privilege; PG16 rejects it with unrecognized privilege type "maintain". It's an artifact of Supabase's default GRANT ALL bundle and is meaningless for the anon / authenticated / service_role API roles (RLS governs access).

Under psql -v ON_ERROR_STOP=1 the schema aborted at the first of these (exit code 3), so the Test isotope-complete.sql against PostgreSQL step turned the workflow red.

The fix

Fix at the root (the generator) and reproduce its corrected output in the committed dump:

  • scripts/schema-dump.mjs β€” skip Supabase-managed platform extensions, and drop the MAINTAIN privilege from the table-grants query, so a future regeneration from the PG17 project stays installable on PG16+.
  • isotope-complete.sql β€” remove the supabase_vault CREATE EXTENSION line and the 126 GRANT MAINTAIN lines (127 lines deleted). Table/policy/function counts unchanged.
  • .github/workflows/schema-lint.yml β€” add supabase_vault to the cloud-only strip list as a defensive safety net (matches the existing supabase_admin/pg_net entries).

Verification

Validated on a local PostgreSQL 16 instance using the same Supabase auth/storage/role shim CI uses:

  • Before: psql exit 3 (aborts at supabase_vault; next error GRANT MAINTAIN).
  • After: psql exit 0, zero errors β€” 44 public tables, 153 RLS policies, 122 functions.
  • Other ci.yml gates that touch changed files (server smoke boot, validate-docs, check-dollar-quotes, Supabase tooling parse) still pass; schema-dump.mjs passes node --check.

Docker/PG17 was unavailable in the working environment, so the fix was chosen specifically so it could be fully verified on PG16 while remaining valid on PG17. See the explainer for the alternatives considered (bumping the shim to postgres:17, or stripping in CI only).

Explainer doc

πŸ“„ Explainer β€” Fixing schema-lint CI (PG17 dump vs PG16 shim)

Notes / follow-ups (out of scope)

The migration-file steps in schema-lint.yml count errors with grep -c '^ERROR', which never matches psql's psql:file:line: ERROR: output β€” so those steps can't currently turn red (a pre-existing hypopg error in sql/isotope-schema-restore.sql is masked by this). Left untouched here to avoid introducing new failures; flagged for a separate PR.

Co-authored-by: Suydev elixir.suyashprabhu@gmail.com

…supabase_vault)

isotope-complete.sql was regenerated from the hosted Supabase project, which now
runs PostgreSQL 17. The dump therefore carried two constructs that stock
PostgreSQL 16 β€” the version pinned by the schema-lint CI shim and used by fresh
self-hosted installs β€” cannot execute:

  * CREATE EXTENSION "supabase_vault" β€” a Supabase-managed extension that does
    not exist on stock Postgres of any version. Nothing in the schema references
    vault.* objects.
  * 126x GRANT MAINTAIN ON TABLE ... β€” MAINTAIN is a Postgres 17 privilege;
    PG16 rejects it with "unrecognized privilege type". It is an artifact of
    Supabase's default GRANT-ALL bundle and is meaningless for the anon /
    authenticated / service_role API roles (RLS governs access).

Under `psql -v ON_ERROR_STOP=1` the schema aborted at the first of these, so the
"Test isotope-complete.sql against PostgreSQL" step exited non-zero and turned
the whole SQL Schema Validation workflow red.

Fix at the root (the generator) and reproduce its corrected output in the
committed dump:

  * scripts/schema-dump.mjs: skip Supabase-managed platform extensions and drop
    the MAINTAIN privilege, so a future regeneration from the PG17 project stays
    installable on PG16+.
  * isotope-complete.sql: remove the supabase_vault CREATE EXTENSION line and the
    126 GRANT MAINTAIN lines (127 lines removed).
  * .github/workflows/schema-lint.yml: add supabase_vault to the cloud-only strip
    list as a defensive safety net, matching the existing supabase_admin/pg_net
    entries.

Verified against a local PostgreSQL 16 instance with the same Supabase auth/
storage shim CI uses: the schema now executes with exit code 0 and zero errors
(44 public tables, 153 RLS policies, 122 functions). ci.yml gates (server smoke,
docs, dollar-quotes, supabase tooling) still pass.

Co-authored-by: Suydev <elixir.suyashprabhu@gmail.com>
@netlify

netlify Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

βœ… Deploy Preview for merry-starship-529305 ready!

Name Link
πŸ”¨ Latest commit d41e5b6
πŸ” Latest deploy log https://app.netlify.com/projects/merry-starship-529305/deploys/6a9fd04a2c46640008bb1711
😎 Deploy Preview https://deploy-preview-9--merry-starship-529305.netlify.app
πŸ“± Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
πŸ€– Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@supabase

supabase Bot commented Sep 8, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project vteqquoqvksshmfhuepu because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings β†—οΈŽ.


Preview Branches by Supabase.
Learn more about Supabase Branching β†—οΈŽ.

@github-actions

Copy link
Copy Markdown
Contributor

πŸ‘‹ This PR hasn't had any activity for 14 days.

It will be automatically closed in 7 days unless there's a review, commit, or comment.

  • Rebase and push to refresh it
  • Add a comment if you need help getting it merged

@github-actions github-actions Bot added the stale label Sep 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

πŸ”’ This PR was automatically closed due to inactivity.

Feel free to reopen it when you're ready to continue!

@github-actions github-actions Bot closed this Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants