Skip to content

Commit dbe51c4

Browse files
committed
test
1 parent 03d95f1 commit dbe51c4

File tree

1 file changed

+4
-2
lines changed
  • ansible/files/admin_api_scripts/pg_upgrade_scripts

1 file changed

+4
-2
lines changed

ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ declare
323323
supabase_admin_rolpassword text := (select rolpassword from pg_authid where rolname = 'supabase_admin');
324324
postgres_role_settings text[] := (select setconfig from pg_db_role_setting where setdatabase = 0 and setrole = 'postgres'::regrole);
325325
supabase_admin_role_settings text[] := (select setconfig from pg_db_role_setting where setdatabase = 0 and setrole = 'supabase_admin'::regrole);
326-
schemas jsonb[] := (select coalesce(array_agg(jsonb_build_object('oid', oid, 'acl', nspacl::text)), '{}') from pg_namespace where nspowner = 'postgres'::regrole);
326+
schemas jsonb[] := (select coalesce(array_agg(jsonb_build_object('oid', oid, 'owner', nspowner::regrole, 'acl', nspacl::text)), '{}') from pg_namespace);
327327
types jsonb[] := (
328328
select coalesce(array_agg(jsonb_build_object('oid', t.oid, 'acl', t.typacl::text)), '{}')
329329
from pg_type t
@@ -464,7 +464,9 @@ begin
464464
-- schemas
465465
foreach obj in array schemas
466466
loop
467-
execute(format('alter schema %s owner to postgres;', (obj->>'oid')::regnamespace));
467+
if obj->>'owner' = 'postgres' then
468+
execute(format('alter schema %s owner to postgres;', (obj->>'oid')::regnamespace));
469+
end if;
468470
-- TODO: don't modify system catalog directly
469471
update pg_namespace set nspacl = (obj->>'acl')::aclitem[] where nspname = obj->>'oid';
470472
end loop;

0 commit comments

Comments
 (0)