Skip to main content
POST
Repair ownership
Repairs object ownership for a supported legacy database after a self-managed import. The agent refuses this operation on a managed database with a protected SQL Explorer role; that database requires the managed grants manifest path.

When to use this

Call this endpoint after you’ve imported a dump into a supported legacy database yourself (see Restore your own dump) and verified that an ownership mismatch causes the failure. Why it happens: A dump can carry object owners from the source server that differ from your DBHost owner role. Restores that DBHost runs from its own backups already end with this repair step. Use this endpoint for:
  • Clean-up after your own psql / pg_restore import.
  • Databases restored before the automatic repair existed.
  • A legacy import whose object owners differ from the database owner.
If a managed Runtime or Readonly role receives permission denied, check its explicit GRANT and default privileges in your migrations. Changing the owner role does not grant access to those app roles. DBHost managed restores use a separate manifest-backed repair path.

Path parameters

What it does

For a supported legacy target database only:
  1. ALTER SCHEMA public OWNER TO <owner> + grants USAGE, CREATE.
  2. Iterates every non-system schema and issues ALTER TABLE/SEQUENCE/VIEW/MATERIALIZED VIEW ... OWNER TO <owner>.
  3. Restores read access for the dashboard SQL Explorer on the affected tables.
The operation is scoped to a single database. It cannot affect any other tenant’s data.

Response

200 OK

Errors

CLI

Running this when ownership is already correct is a no-op — every ALTER ... OWNER TO statement is idempotent.