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

Lines changed: 11 additions & 1 deletion
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy