supabase / postgres

Unmodified Postgres with some useful plugins
https://supabase.com
PostgreSQL License
1.33k stars 137 forks source link

Cannot connect to hosted postgres as user supabase_admin. User postgres does not have permissions to run some operations. #1007

Closed evelant closed 1 month ago

evelant commented 2 months ago

Bug report

Describe the bug

Per the title it appears there is no way to connect to supabase hosted postgres as the supabase_admin user. I wanted to do this so I could drop some schemas and then restore them from an earlier dump. The postgres user can't drop a schema like auth because it is owned by supabase_admin.

To Reproduce

Try to connect to hosted db as supabase_admin like so:

PGPASSWORD=yourSupabaseDbPassword psql -c 'drop schema if exists public cascade; drop schema if exists auth cascade;' -d postgres --username=supabase_admin.yourProjectIdHere --host=aws-0-us-east-1.pooler.supabase.com --port=5432

Expected behavior

Either everything should be owned by postgres or we should have access to log in as supabase_admin to manage things that postgres cannot do.

Screenshots

N/A

System information

N/A

Additional context

olirice commented 1 month ago

I appreciate that having superuser would makes some activities, easier to deal with but we're not able to distribute superuser credentials on the cloud platform for security and maintainability

there are some niche features in postgres that let it manipulate the underlying machine more than is acceptable in a hosted environment. We also need to make sure our infra retains access to each database for backups, alerting, etc. With superuser, end customers might accidentally inhibit that access and lock out our support team in a way we'd be unable to recover from.

If you need assistance with something specific, I'd recommend reaching out to support. Also note that the docker image doesn't have the same restrictions if that helps you