realtime icon indicating copy to clipboard operation
realtime copied to clipboard

log_min_messages requires elevated privileges

Open nkreiger opened this issue 2 years ago • 1 comments

Chore

Describe the chore

In order to set the parameter log_min_messages you need elevated privileges,

https://github.com/supabase/realtime/blob/e34899b6829b49d7e2ea769717059e3ba1835fea/lib/extensions/postgres_cdc_rls/repo/migrations/20230328144023_create_list_changes_function.ex#L11

These privileges cannot be achieved in certain managed Cloud SQL instances. It would be great to wrap this in a function, or maybe check the permissions before running it?

Additional context

Maybe something like this, or something smarter

DO $$ BEGIN BEGIN -- Attempt to set the parameter EXECUTE 'SET log_min_messages TO ''fatal'''; RAISE NOTICE 'log_min_messages set to ''fatal'''; EXCEPTION WHEN others THEN -- Handle the error when privileges are insufficient RAISE NOTICE 'You do not have the required privileges to set log_min_messages'; END; END $$

nkreiger avatar Jul 02 '23 16:07 nkreiger

Any thoughts about this? I can line up a PR if there is no objection?

https://github.com/supabase/realtime/pull/617

for review

nkreiger avatar Jul 05 '23 22:07 nkreiger