diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_507.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_507.sql index b8ded7d5a..03767e159 100644 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_507.sql +++ b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_507.sql @@ -37,7 +37,29 @@ RETURNS text LANGUAGE INTERNAL STABLE STRICT AS 'sys_connect_by_path'; ------ -- int16 ------ +-- drop operators that depends on int16 first. +do $$ +BEGIN + for ans in select case when count(*) = 1 then true else false end as ans from (select typname from pg_type where typname = 'int16' limit 1) + LOOP + if ans.ans = true then + DROP OPERATOR IF EXISTS pg_catalog.=(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.<>(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.<(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.<=(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.>(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.>=(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.+(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.-(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.*(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog./(int16, int16) CASCADE; + end if; + exit; + END LOOP; +END$$; + DROP TYPE IF EXISTS pg_catalog.int16 CASCADE; +DROP TYPE IF EXISTS pg_catalog._int16 CASCADE; SET LOCAL inplace_upgrade_next_system_object_oids = IUO_TYPE, 34, 0, b; CREATE TYPE pg_catalog.int16; @@ -3292,4 +3314,4 @@ CREATE VIEW pg_catalog.pg_replication_origin_status AS SELECT * FROM pg_show_replication_origin_status(); -REVOKE ALL ON pg_catalog.pg_replication_origin_status FROM public; \ No newline at end of file +REVOKE ALL ON pg_catalog.pg_replication_origin_status FROM public; diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_507.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_507.sql index 3665cc78b..fa2e6bb1a 100644 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_507.sql +++ b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_507.sql @@ -37,7 +37,29 @@ RETURNS text LANGUAGE INTERNAL STABLE STRICT AS 'sys_connect_by_path'; ------ -- int16 ------ +-- drop operators that depends on int16 first. +do $$ +BEGIN + for ans in select case when count(*) = 1 then true else false end as ans from (select typname from pg_type where typname = 'int16' limit 1) + LOOP + if ans.ans = true then + DROP OPERATOR IF EXISTS pg_catalog.=(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.<>(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.<(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.<=(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.>(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.>=(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.+(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.-(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog.*(int16, int16) CASCADE; + DROP OPERATOR IF EXISTS pg_catalog./(int16, int16) CASCADE; + end if; + exit; + END LOOP; +END$$; + DROP TYPE IF EXISTS pg_catalog.int16 CASCADE; +DROP TYPE IF EXISTS pg_catalog._int16 CASCADE; SET LOCAL inplace_upgrade_next_system_object_oids = IUO_TYPE, 34, 0, b; CREATE TYPE pg_catalog.int16; @@ -3291,4 +3313,4 @@ CREATE VIEW pg_catalog.pg_replication_origin_status AS SELECT * FROM pg_show_replication_origin_status(); -REVOKE ALL ON pg_catalog.pg_replication_origin_status FROM public; \ No newline at end of file +REVOKE ALL ON pg_catalog.pg_replication_origin_status FROM public;