Altering the Owner of All Tables in PostgreSQL
You can alter the owner of multiple tables at once by scripting PL/pgSQL
alter database :database owner to :owner;
do $$ declare t text; begin
for t in select table_name
from information_schema.tables
where table_schema = :schema
and table_catalog = :database
loop
execute format(
(
'alter table ' || :database || '.' || :schema
|| '.%s owner to ' || :owner
), t
);
end loop;
end $$;