From cb831efeb2f8b4637c481cf40a7116ff668b6fb9 Mon Sep 17 00:00:00 2001 From: openGaussDev Date: Fri, 11 Mar 2022 14:52:57 +0800 Subject: [PATCH] fix problem that int16 upgrade Match-id-e1d589f34a5010fa5d06d285a9d81900e127d908 --- .../upgrade-post_catalog_maindb_92_507.sql | 24 ++++++++++++++++++- .../upgrade-post_catalog_otherdb_92_507.sql | 24 ++++++++++++++++++- 2 files changed, 46 insertions(+), 2 deletions(-) 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;