Skip to content

Commit c5b6202

Browse files
committed
fix: pgmq ownership
1 parent 34cbe36 commit c5b6202

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
do $$
2+
declare
3+
extoid oid := (select oid from pg_extension where extname = 'pgmq');
4+
r record;
5+
begin
6+
set local search_path = '';
7+
update pg_extension set extowner = 'postgres'::regrole where extname = 'pgmq';
8+
for r in (select * from pg_depend where refobjid = extoid) loop
9+
if r.classid = 'pg_type'::regclass then
10+
execute(format('alter type %s owner to postgres;', r.objid::regtype));
11+
elsif r.classid = 'pg_proc'::regclass then
12+
execute(format('alter function %s(%s) owner to postgres;', r.objid::regproc, pg_get_function_identity_arguments(r.objid)));
13+
elsif r.classid = 'pg_class'::regclass then
14+
execute(format('alter table %s owner to postgres;', r.objid::regclass));
15+
else
16+
raise exception 'error on pgmq after-create script: unexpected object type %', r.classid;
17+
end if;
18+
end loop;
19+
end $$;

0 commit comments

Comments
 (0)