Skip to content

Commit c7e4da9

Browse files
committed
Merge branch 'schema-ownership-fix' into 'master'
Change ownership of all schemas to the new owner See merge request postgres-ai/database-lab!308
2 parents 405c7b4 + 6009497 commit c7e4da9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

pkg/services/provision/databases/postgres/postgres_mgmt.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,17 @@ declare
114114
begin
115115
new_owner := @usernameStr;
116116
117+
-- allow working with all schemas
118+
for r in select * from pg_namespace loop
119+
raise debug 'Changing ownership of schema % to %',
120+
r.nspname, new_owner;
121+
execute format(
122+
'alter schema %I owner to %I;',
123+
r.nspname,
124+
new_owner
125+
);
126+
end loop;
127+
117128
-- c: composite type
118129
-- p: partitioned table
119130
-- i: index
@@ -210,7 +221,6 @@ begin
210221
end loop;
211222
212223
grant select on pg_stat_activity to @username;
213-
214224
end
215225
$$;
216226
`

0 commit comments

Comments
 (0)