curl --request POST \
--url https://api.example.com/api/v1/databases/{id}/repair-ownershipReassign ownership of a database’s objects to the owner role after a restore.
curl --request POST \
--url https://api.example.com/api/v1/databases/{id}/repair-ownershippg_dump into your database and then see permission denied for table X (Postgres SQLSTATE 42501) when your application connects.
Why it happens: pg_dump / pg_restore runs as a superuser on the DBHost side. The restored tables end up owned by the superuser (or by whatever role name is baked into the dump — often postgres). Your application, however, connects as the owner role for your database, which doesn’t own the restored tables and therefore can’t read them.
New restores triggered through DBHost automatically run this repair step at the end. This endpoint exists for:
psql / pg_restore activity.permission denied on tables you expect to own.| Parameter | Type | Description |
|---|---|---|
id | uuid | Database ID |
ALTER SCHEMA public OWNER TO <owner> + grants USAGE, CREATE.ALTER TABLE/SEQUENCE/VIEW/MATERIALIZED VIEW ... OWNER TO <owner>.SELECT on the restored tables so the dashboard explorer keeps working.{
"name": "mydb",
"status": "repaired",
"message": "Ownership repair completed for 'mydb'"
}
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Missing or invalid API key |
| 404 | DATABASE_NOT_FOUND | Database doesn’t exist, isn’t owned by this user, or isn’t in scope for this key |
| 500 | AGENT_ERROR | The VPS agent couldn’t connect to the database or reassign ownership |
dbhost databases repair-ownership <database-id>
ALTER ... OWNER TO statement is idempotent.