delete from upg_catalog.pg_conversion where conname in ('euc_jis_2004_to_shift_jis_2004', 'euc_jis_2004_to_utf8', 'koi8_u_to_utf8', 'utf8_to_koi8_u', 'shift_jis_2004_to_utf8', 'shift_jis_2004_to_euc_jis_2004', 'utf8_to_euc_jis_2004', 'utf8_to_shift_jis_2004');
update upg_catalog.pg_conversion set conforencoding = 5 where conforencoding = 40;
update upg_catalog.pg_conversion set contoencoding = 5 where contoencoding = 40;
update upg_catalog.pg_conversion set conforencoding = conforencoding - 1 where conforencoding >= 34;
update upg_catalog.pg_conversion set contoencoding = contoencoding - 1 where contoencoding >= 34;
DROP FUNCTION upg_catalog.euc_jis_2004_to_shift_jis_2004 (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER);
DROP FUNCTION upg_catalog.shift_jis_2004_to_euc_jis_2004 (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER);
DROP FUNCTION upg_catalog.utf8_to_shift_jis_2004 (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER);
DROP FUNCTION upg_catalog.shift_jis_2004_to_utf8 (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER);
DROP FUNCTION upg_catalog.utf8_to_euc_jis_2004 (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER);
DROP FUNCTION upg_catalog.euc_jis_2004_to_utf8 (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER);
DROP FUNCTION upg_catalog.utf8_to_koi8u (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER);
DROP FUNCTION upg_catalog.koi8u_to_utf8 (INTEGER, INTEGER, CSTRING, INTERNAL, INTEGER);
update upg_catalog.pg_rewrite set ev_action = replace(ev_action, 'parentpartitioname','parentpartitionname') where ev_class = 'upg_catalog.pg_partitions'::regclass;
update upg_catalog.pg_attribute set attname = 'parentpartitionname' where attname = 'parentpartitioname' and attrelid = 'upg_catalog.pg_partitions'::regclass;
-- fixup attislocal
update upg_catalog.pg_attribute set attislocal = 'f' from pg_catalog.pg_partitions where attislocal = 't' and attrelid = (quote_ident(partitionschemaname) || '.' || quote_ident(partitiontablename))::regclass and attnum > 0;
-- Drop the old function "gp_update_ao_master_stats" (oid 7156)
delete from upg_catalog.pg_proc where oid = 7156;
delete from upg_catalog.pg_description where objoid = 7156;
delete from upg_catalog.pg_depend where refobjid = 7156;
-- We no longer track dependencies on table implementation types, toast tables or indices
delete from upg_catalog.pg_shdepend using upg_catalog.pg_class c where classid='pg_type'::regclass and objid = reltype and relkind != 'c';
delete from upg_catalog.pg_shdepend using upg_catalog.pg_class c where classid='pg_class'::regclass and objid = c.oid and relkind in ('t', 'i');