• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 29819898249

21 Jul 2026 09:44AM UTC coverage: 65.234% (+0.2%) from 65.08%
29819898249

push

github

web-flow
fix(cli): repair remote db pull with pg-delta and per-connection role step-down (#5895)

## Summary

Remote `db pull --linked` with the pg-delta engine reported **"No schema
changes found"** on every hosted project, and the migra fallback failed
at the final migration-history write with `permission denied for
database postgres` (Slack report, supabase/cli#5826). Three stacked
causes, all addressed here:

**1. pg-delta required superuser to extract (fixed upstream, version
bump here).** Up to alpha.31, extraction read
`pg_catalog.pg_user_mapping` (superuser-only), so extracting as the temp
`cli_login_postgres` role failed with SQLSTATE 42501 on every hosted
project. It only worked locally because local connections use
`supabase_admin`. `@supabase/pg-delta@1.0.0-alpha.32` reads the
world-readable `pg_user_mappings` view instead; this PR bumps the
default pinned version (Go `DefaultPgDeltaNpmVersion` + TS
`LEGACY_DEFAULT_PG_DELTA_NPM_VERSION`).

**2. pg-delta script crashes were swallowed as an empty diff.** The Deno
templates force the edge-runtime worker to exit by throwing on both the
success and failure paths, and both runners (Go `RunEdgeRuntimeScript`,
TS `legacy-edge-runtime-script.layer.ts`) suppress any non-zero exit
whose stderr contains "main worker has been destroyed" — making a crash
indistinguishable from a genuinely empty diff. The template catch blocks
now print a `PGDELTA_SCRIPT_ERROR` sentinel to stderr, and both runners
treat its presence as a hard failure that surfaces the collected stderr
(so users see the real error instead of "No schema changes found").

**3. alpha.32 changed the plan API.** Plan statements moved into
execution-aware `units` (+ `sessionStatements`); the diff template's
`result?.plan.statements ?? []` silently produced an empty diff. The
template now uses `flattenPlanStatements(result.plan)`. TS template
embeds regenerated from the Go sources (byte-equality test unchanged).

**4. The TS role step-down was lost mid-c... (continued)

11247 of 17241 relevant lines covered (65.23%)

10.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

24.42
/internal/db/diff/pgadmin.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc