Postgres script to identify and change ownership

Running into an issue where the current Postgres database continues to get the wrong owner placed on the new/modified table.  This handy script identifies the user that should own tables (you know that beforehand) and gives the appropriate statements to correct table/view ownership

select t.table_name, t.table_type, c.relname, c.relowner, u.usename
from information_schema.tables t
join pg_catalog.pg_class c on (t.table_name = c.relname)
join pg_catalog.pg_user u on (c.relowner = u.usesysid)
where t.table_schema='public';


select 'ALTER TABLE ' || t.tablename || ' OWNER TO desired_owner;'
from  pg_tables t
where t.tableowner = 'current_user_owner';

select 'ALTER VIEW ' || v.viewname || ' OWNER TO desired_owner;'
from  pg_views v
where v.viewowner = 'current_user_owner';