Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure that any pgmq sequences owned by supabase_admin are transferred to postgres #1384

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ begin
case when c.relpersistence = 'u' then true else false end as is_unlogged,
now() as created_at
from
pg_catalog.pg_class c
join pg_catalog.pg_namespace n
on c.relnamespace = n.oid
pg_catalog.pg_class c
join pg_catalog.pg_namespace n
on c.relnamespace = n.oid
where
n.nspname = 'pgmq'
and c.relname like 'q_%'
Expand All @@ -41,4 +41,23 @@ begin
end if;
end $$;

do $$
declare
rec record;
begin
for rec in
select n.nspname as sequence_schema, c.relname as sequence_name
from pg_catalog.pg_class c
join pg_catalog.pg_namespace n on n.oid = c.relnamespace
join pg_catalog.pg_roles r on r.oid = c.relowner
where
c.relkind = 'S'
and n.nspname = 'pgmq'
and r.rolname = 'supabase_admin'
loop
execute format('alter sequence %I.%I owner to postgres', rec.sequence_schema, rec.sequence_name);
end loop;
end;
$$;

-- migrate:down
Loading