postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Allow CREATE SUBSCRIPTION command without needing superuser privilege

Open burggraf opened this issue 1 year ago • 9 comments

Edit: this requires PostgreSQL v17, its deployment is in progress.

Supabase currently supports: CREATE PUBLICATION my_publication FOR ALL TABLES;

but does not support: CREATE SUBSCRIPTION my_subscription CONNECTION '<connection_string>' PUBLICATION my_publication;

The error given is: ERROR: 42501: must be superuser to create subscriptions

In order to be able to use logical replication to replicate individual tables (or all tables in a schema) between Supabase projects, CREATE SUBSCRIPTION should be executable by the postgres user without supseruser privileges, in parity with the CREATE PUBLICATION command.

burggraf avatar Feb 07 '24 15:02 burggraf

Any update here? This guide is clearly outdated if this is no longer supported: https://supabase.com/docs/guides/database/postgres/setup-replication-external

ianwoodfill avatar Mar 02 '24 18:03 ianwoodfill

Any updates on this issue? I'm having the same problem

alexandredev3 avatar Mar 19 '24 14:03 alexandredev3

Seems like subscriptions are no longer supported, period.

https://supabase.com/docs/guides/database/postgres/roles-superuser

frankyw avatar Apr 05 '24 19:04 frankyw

Looking for this as well, hopefully can get implemented soon.

rustamd avatar Jun 29 '24 11:06 rustamd

This will come for free once pg 17 is supported.

steve-chavez avatar Jan 23 '25 23:01 steve-chavez

I followed the same guide on how to setup replication on Supabase but superuser is needed so the guide is obsolete? At least remove that page on the docs almost 1 year after users in this thread notified you about it?

https://supabase.com/docs/guides/database/postgres/setup-replication-external

t0mdicks0n avatar Jan 30 '25 15:01 t0mdicks0n

Hey folks,

The guide there is for replicating to an external system so the subscription is created on the target database. Creating publications etc are supported without superuser permissions

encima avatar Jun 13 '25 06:06 encima

any update?

Lanznx avatar Jun 14 '25 06:06 Lanznx

Yep, this is possible for the postgres user as of 17.4 and is rolling out across regions currently

On Sat, 14 Jun 2025 at 09:15, Brandon Lu @.***> wrote:

Lanznx left a comment (supabase/postgres#1646) https://github.com/supabase/postgres/issues/1646

any update?

— Reply to this email directly, view it on GitHub https://github.com/supabase/postgres/issues/1646, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD6OI5TAZNNFP4HCFS7U3L3DO4Y7AVCNFSM6AAAAABVYO7YDKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSNZSGMZDCOJSGY . You are receiving this because you commented.Message ID: @.***>

encima avatar Jun 15 '25 16:06 encima

Update: PG17 has now been rolled out to all regions. You can do CREATE SUBSCRIPTION by upgrading to PG17 via Project Settings > Infrastructure, so closing this.

soedirgo avatar Jul 07 '25 14:07 soedirgo

I attempted to create subscription but got this error

ERROR: 08P01: could not create replication slot "rds_sub": ERROR: must be superuser or replication role to use logical replication slots in the 'rds' namespace

vrijmetse avatar Sep 30 '25 23:09 vrijmetse

@vrijmetse Are you on Postgres 17?

encima avatar Oct 01 '25 07:10 encima

@vrijmetse Are you on Postgres 17?

Yes 17.6.1.011

vrijmetse avatar Oct 01 '25 07:10 vrijmetse

Ah, that error looks like a non supabase issue? You can create a normal subscription but not one for the RDS namespace

EDIT: can confirm this is not a Supabase issue. The slot in the other DB may need superuser perms to create. You can precreate the slot and specify or you can use rds_superuser

encima avatar Oct 01 '25 08:10 encima