From a73f5fcf91812d0eb496778b1765608fb8bf77d2 Mon Sep 17 00:00:00 2001 From: TotaJ Date: Thu, 30 Dec 2021 19:10:41 +0800 Subject: [PATCH] Fix upgrade script for publication --- .../rollback-post_catalog_maindb_92_420.sql | 275 ---- .../rollback-post_catalog_maindb_92_425.sql | 60 - .../rollback_catalog_maindb_92_420.sql | 529 ------ .../rollback_catalog_maindb_92_421.sql | 5 - .../rollback_catalog_maindb_92_422.sql | 18 - .../rollback_catalog_maindb_92_424.sql | 2 - .../rollback_catalog_maindb_92_425.sql | 13 - .../rollback_catalog_maindb_92_506.sql | 1 + .../rollback_catalog_maindb_92_507.sql | 2 +- .../rollback-post_catalog_otherdb_92_420.sql | 275 ---- .../rollback-post_catalog_otherdb_92_425.sql | 60 - .../rollback_catalog_otherdb_92_420.sql | 529 ------ .../rollback_catalog_otherdb_92_421.sql | 5 - .../rollback_catalog_otherdb_92_422.sql | 18 - .../rollback_catalog_otherdb_92_424.sql | 2 - .../rollback_catalog_otherdb_92_425.sql | 13 - .../rollback_catalog_otherdb_92_506.sql | 1 + .../rollback_catalog_otherdb_92_507.sql | 2 +- .../upgrade-post_catalog_maindb_92_420.sql | 1418 ----------------- .../upgrade-post_catalog_maindb_92_425.sql | 148 -- .../upgrade-post_catalog_maindb_92_507.sql | 2 +- .../upgrade_catalog_maindb_92_420.sql | 0 .../upgrade_catalog_maindb_92_421.sql | 4 - .../upgrade_catalog_maindb_92_422.sql | 20 - .../upgrade_catalog_maindb_92_424.sql | 22 - .../upgrade_catalog_maindb_92_425.sql | 43 - .../upgrade-post_catalog_otherdb_92_420.sql | 1418 ----------------- .../upgrade-post_catalog_otherdb_92_425.sql | 148 -- .../upgrade-post_catalog_otherdb_92_507.sql | 2 +- .../upgrade_catalog_otherdb_92_420.sql | 0 .../upgrade_catalog_otherdb_92_421.sql | 4 - .../upgrade_catalog_otherdb_92_422.sql | 20 - .../upgrade_catalog_otherdb_92_424.sql | 22 - .../upgrade_catalog_otherdb_92_425.sql | 43 - 34 files changed, 6 insertions(+), 5118 deletions(-) delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_420.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_425.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_420.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_421.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_422.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_424.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_425.sql create mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_506.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_420.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_425.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_420.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_421.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_422.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_424.sql delete mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_425.sql create mode 100644 src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_506.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_420.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_425.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_420.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_421.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_422.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_424.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_425.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_420.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_425.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_420.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_421.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_422.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_424.sql delete mode 100644 src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_425.sql diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_420.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_420.sql deleted file mode 100644 index b931b2c1a..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_420.sql +++ /dev/null @@ -1,275 +0,0 @@ --------------------------------------------------------------- --- delete pg_amop --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Delete_pg_amop_temp() -RETURNS void -AS $$ -DECLARE -row_name record; -query_str text; -query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - delete from pg_catalog.pg_amop where amopfamily in (4033, 4034, 4035, 4036, 4037); - END LOOP; -return; -END; -$$ LANGUAGE 'plpgsql'; - -SELECT Delete_pg_amop_temp(); -DROP FUNCTION Delete_pg_amop_temp(); - - --------------------------------------------------------------- --- delete pg_amproc --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Delete_pg_amproc_temp() -RETURNS void -AS $$ -DECLARE -row_name record; -query_str text; -query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - delete from pg_catalog.pg_amproc where amprocfamily in (4033, 4034, 4035, 4036, 4037); - END LOOP; -return; -END; -$$ LANGUAGE 'plpgsql'; - -SELECT Delete_pg_amproc_temp(); -DROP FUNCTION Delete_pg_amproc_temp(); - - --------------------------------------------------------------- --- delete pg_opclass --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Delete_pg_opclass_temp() -RETURNS void -AS $$ -DECLARE -row_name record; -query_str text; -query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - delete from pg_catalog.pg_opclass where opcfamily in (4033, 4034, 4035, 4036, 4037); - END LOOP; -return; -END; -$$ LANGUAGE 'plpgsql'; - -SELECT Delete_pg_opclass_temp(); -DROP FUNCTION Delete_pg_opclass_temp(); - - --------------------------------------------------------------- --- delete pg_cast --------------------------------------------------------------- -DO $$ -DECLARE -ans boolean; -BEGIN - select case when count(*)=1 then true else false end as ans from (select * from pg_type where typname = 'jsonb' limit 1) into ans; - if ans = true then - DROP CAST IF EXISTS (json AS jsonb) CASCADE; - DROP CAST IF EXISTS (jsonb AS json) CASCADE; - end if; -END$$; - - --------------------------------------------------------------- --- delete pg_opfamily --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Delete_pg_opfamily_temp() -RETURNS void -AS $$ -DECLARE -row_name record; -query_str text; -query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - delete from pg_catalog.pg_opfamily where oid in (4033, 4034, 4035, 4036, 4037); - END LOOP; -return; -END; -$$ LANGUAGE 'plpgsql'; - -SELECT Delete_pg_opfamily_temp(); -DROP FUNCTION Delete_pg_opfamily_temp(); - - --------------------------------------------------------------- --- delete pg_operator --------------------------------------------------------------- -DROP OPERATOR IF EXISTS pg_catalog.->(json, text) cascade; -DROP OPERATOR IF EXISTS pg_catalog.->>(json, text) cascade; -DROP OPERATOR IF EXISTS pg_catalog.->(json, integer) cascade; -DROP OPERATOR IF EXISTS pg_catalog.->>(json, integer) cascade; -DROP OPERATOR IF EXISTS pg_catalog.#>(json, _text) cascade; -DROP OPERATOR IF EXISTS pg_catalog.#>>(json, _text) cascade; - -DO $$ -DECLARE -ans boolean; -BEGIN - select case when count(*)=1 then true else false end as ans from (select * from pg_type where typname = 'jsonb' limit 1) into ans; - if ans = true then - DROP OPERATOR IF EXISTS pg_catalog.->(jsonb, text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.->>(jsonb, text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.->(jsonb, integer) cascade; - DROP OPERATOR IF EXISTS pg_catalog.->>(jsonb, integer) cascade; - DROP OPERATOR IF EXISTS pg_catalog.#>(jsonb, _text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.#>>(jsonb, _text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.=(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.<>(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.<(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.>(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.<=(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.>=(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.@>(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.?(jsonb, text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.?|(jsonb, _text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.?&(jsonb, _text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.<@(jsonb, jsonb) cascade; - end if; -END$$; - - --------------------------------------------------------------- --- delete builtin funcs --------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.gin_compare_jsonb(text, text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_consistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_consistent_jsonb_hash(internal, smallint, anyarray, integer, internal, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb(internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_hash(internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_query(anyarray, internal, smallint, internal, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_query_hash(anyarray, internal, smallint, internal, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_triconsistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_triconsistent_jsonb_hash(internal, smallint, anyarray, integer, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_element(json, integer) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_element_text(json, integer) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_elements(from_json json, OUT value json) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_elements_text(from_json json, OUT value text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_length(json) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_build_array() CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_build_array(VARIADIC "any") CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_build_object() CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_build_object(VARIADIC "any") CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_each(from_json json, OUT key text, OUT value json) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_each_text(from_json json, OUT key text, OUT value text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path(json, VARIADIC text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_op(json, text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_text(json, VARIADIC text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_text_op(json, text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object(text[], text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object(text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object_field(json, text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object_field_text(json, text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object_keys(json) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_populate_record(anyelement, json, boolean) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_populate_recordset(anyelement, json, boolean) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_to_record(json, boolean) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_to_recordset(json, boolean) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.to_json(anyelement) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_typeof(json) CASCADE; - -DO $$ -DECLARE -ans boolean; -BEGIN - select case when count(*)=1 then true else false end as ans from (select * from pg_type where typname = 'jsonb' limit 1) into ans; - if ans = true then - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_element(jsonb, integer) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_element_text(jsonb, integer) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_elements(from_json jsonb, OUT value jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_elements_text(from_json jsonb, OUT value text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_length(jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_cmp(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_contained(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_contains(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_each(from_json jsonb, OUT key text, OUT value jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_each_text(from_json jsonb, OUT key text, OUT value text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_eq(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists(jsonb, text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists_all(jsonb, text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists_any(jsonb, text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path(jsonb, VARIADIC text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_op(jsonb, text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_text(jsonb, VARIADIC text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_text_op(jsonb, text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_ge(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_gt(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_hash(jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_le(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_lt(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_ne(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_field(jsonb, text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_field_text(jsonb, text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_keys(jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_populate_record(anyelement, jsonb, boolean) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_populate_recordset(anyelement, jsonb, boolean) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_typeof(jsonb) CASCADE; - end if; -END$$; ----------------------------------------------------------------- --- recover funcs ----------------------------------------------------------------- -ALTER FUNCTION json_in(cstring) STABLE; -ALTER FUNCTION json_send(json) STABLE; -ALTER FUNCTION json_recv(internal) STABLE; - ----------------------------------------------------------------- --- delete two agg funcs ----------------------------------------------------------------- -drop aggregate if exists pg_catalog.json_object_agg("any", "any"); -DROP FUNCTION IF EXISTS pg_catalog.json_object_agg_finalfn(internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object_agg_transfn(internal, "any", "any") CASCADE; - -drop aggregate if exists pg_catalog.json_agg(anyelement); -DROP FUNCTION IF EXISTS pg_catalog.json_agg_finalfn(internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_agg_transfn(internal, anyelement) CASCADE; - - --------------------------------------------------------------- --- delete type jsonb --------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.jsonb_in(cstring) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.jsonb_recv(internal) CASCADE; -DO $$ -DECLARE -ans boolean; -BEGIN - select case when count(*)=1 then true else false end as ans from (select * from pg_type where typname = 'jsonb' limit 1) into ans; - if ans = true then - DROP FUNCTION IF EXISTS pg_catalog.jsonb_out(jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_send(jsonb) CASCADE; - end if; -END$$; - -DROP TYPE IF EXISTS pg_catalog.jsonb; -DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;UPDATE pg_catalog.pg_am set amcanunique = FALSE where amname = 'cbtree'; -CREATE OR REPLACE VIEW pg_catalog.gs_session_cpu_statistics AS -SELECT - S.datid AS datid, - S.usename, - S.pid, - S.query_start AS start_time, - T.min_cpu_time, - T.max_cpu_time, - T.total_cpu_time, - S.query, - S.node_group, - T.top_cpu_dn -FROM pg_stat_activity_ng AS S, pg_stat_get_wlm_realtime_session_info(NULL) AS T -WHERE S.pid = T.threadid; diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_425.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_425.sql deleted file mode 100644 index 722d7283a..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback-post_catalog_maindb_92_425.sql +++ /dev/null @@ -1,60 +0,0 @@ --- deleting system view -DROP VIEW IF EXISTS pg_catalog.pg_publication_tables; -DROP VIEW IF EXISTS pg_catalog.pg_stat_subscription; -DROP VIEW IF EXISTS pg_catalog.pg_replication_origin_status; - --- deleting function pg_replication_origin_create -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_create(IN node_name text, OUT replication_origin_oid oid) CASCADE; - --- deleting function pg_replication_origin_drop -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_drop(IN node_name text, OUT replication_origin_oid oid) CASCADE; - --- deleting function pg_replication_origin_oid -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_oid(IN node_name text, OUT replication_origin_oid oid) CASCADE; - --- deleting function pg_replication_origin_session_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_setup(IN node_name text) CASCADE; - --- deleting function pg_replication_origin_session_reset -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_reset() CASCADE; - --- deleting function pg_replication_origin_session_is_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_is_setup() CASCADE; - --- deleting function pg_replication_origin_session_progress -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_progress(IN flush boolean) CASCADE; - --- deleting function pg_replication_origin_xact_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_xact_setup(IN origin_lsn text, IN origin_timestamp timestamp with time zone) CASCADE; - --- deleting function pg_replication_origin_xact_reset -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_xact_reset() CASCADE; - --- deleting function pg_replication_origin_advance -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_advance(IN node_name text, IN lsn text) CASCADE; - --- deleting function pg_replication_origin_progress -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_progress(IN node_name text, IN flush boolean) CASCADE; - --- deleting function pg_show_replication_origin_status -DROP FUNCTION IF EXISTS pg_catalog.pg_show_replication_origin_status(OUT local_id oid, OUT external_id text, OUT remote_lsn text, OUT local_lsn text) CASCADE; - --- deleting function pg_get_publication_tables -DROP FUNCTION IF EXISTS pg_catalog.pg_get_publication_tables(IN pubname text, OUT relid oid) CASCADE; - --- deleting function pg_stat_get_subscription -DROP FUNCTION IF EXISTS pg_catalog.pg_stat_get_subscription(IN subid oid, OUT subid oid, OUT pid integer, OUT received_lsn text, OUT last_msg_send_time timestamp with time zone, OUT last_msg_receipt_time timestamp with time zone, OUT latest_end_lsn text, OUT latest_end_time timestamp with time zone) CASCADE; - --- deleting system table pg_subscription - -DROP INDEX IF EXISTS pg_catalog.pg_subscription_oid_index; -DROP INDEX IF EXISTS pg_catalog.pg_subscription_subname_index; -DROP TYPE IF EXISTS pg_catalog.pg_subscription; -DROP TABLE IF EXISTS pg_catalog.pg_subscription; - --- deleting system table pg_replication_origin - -DROP INDEX IF EXISTS pg_catalog.pg_replication_origin_roident_index; -DROP INDEX IF EXISTS pg_catalog.pg_replication_origin_roname_index; -DROP TYPE IF EXISTS pg_catalog.pg_replication_origin; -DROP TABLE IF EXISTS pg_catalog.pg_replication_origin; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_420.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_420.sql deleted file mode 100644 index 489bbb5cb..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_420.sql +++ /dev/null @@ -1,529 +0,0 @@ -SET search_path TO information_schema; - --- element_types is generated by data_type_privileges -DROP VIEW IF EXISTS information_schema.element_types CASCADE; - --- data_type_privileges is generated by columns -DROP VIEW IF EXISTS information_schema.data_type_privileges CASCADE; --- data_type_privileges is generated by table_privileges -DROP VIEW IF EXISTS information_schema.role_column_grants CASCADE; --- data_type_privileges is generated by column_privileges -DROP VIEW IF EXISTS information_schema.role_table_grants CASCADE; - --- other views need upgrade for matview -DROP VIEW IF EXISTS information_schema.column_domain_usage CASCADE; -DROP VIEW IF EXISTS information_schema.column_privileges CASCADE; -DROP VIEW IF EXISTS information_schema.column_udt_usage CASCADE; -DROP VIEW IF EXISTS information_schema.columns CASCADE; -DROP VIEW IF EXISTS information_schema.table_privileges CASCADE; -DROP VIEW IF EXISTS information_schema.tables CASCADE; -DROP VIEW IF EXISTS information_schema.view_column_usage CASCADE; -DROP VIEW IF EXISTS information_schema.view_table_usage CASCADE; - -CREATE VIEW information_schema.column_domain_usage AS - SELECT CAST(current_database() AS sql_identifier) AS domain_catalog, - CAST(nt.nspname AS sql_identifier) AS domain_schema, - CAST(t.typname AS sql_identifier) AS domain_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_type t, pg_namespace nt, pg_class c, pg_namespace nc, - pg_attribute a - - WHERE t.typnamespace = nt.oid - AND c.relnamespace = nc.oid - AND a.attrelid = c.oid - AND a.atttypid = t.oid - AND t.typtype = 'd' - AND c.relkind IN ('r', 'v', 'f') - AND a.attnum > 0 - AND NOT a.attisdropped - AND pg_has_role(t.typowner, 'USAGE'); - -CREATE VIEW information_schema.column_privileges AS - SELECT CAST(u_grantor.rolname AS sql_identifier) AS grantor, - CAST(grantee.rolname AS sql_identifier) AS grantee, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(x.relname AS sql_identifier) AS table_name, - CAST(x.attname AS sql_identifier) AS column_name, - CAST(x.prtype AS character_data) AS privilege_type, - CAST( - CASE WHEN - -- object owner always has grant options - pg_has_role(x.grantee, x.relowner, 'USAGE') - OR x.grantable - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable - - FROM ( - SELECT pr_c.grantor, - pr_c.grantee, - attname, - relname, - relnamespace, - pr_c.prtype, - pr_c.grantable, - pr_c.relowner - FROM (SELECT oid, relname, relnamespace, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).* - FROM pg_class - WHERE relkind IN ('r', 'v', 'f') - ) pr_c (oid, relname, relnamespace, relowner, grantor, grantee, prtype, grantable), - pg_attribute a - WHERE a.attrelid = pr_c.oid - AND a.attnum > 0 - AND NOT a.attisdropped - UNION - SELECT pr_a.grantor, - pr_a.grantee, - attname, - relname, - relnamespace, - pr_a.prtype, - pr_a.grantable, - c.relowner - FROM (SELECT attrelid, attname, (aclexplode(coalesce(attacl, acldefault('c', relowner)))).* - FROM pg_attribute a JOIN pg_class cc ON (a.attrelid = cc.oid) - WHERE attnum > 0 - AND NOT attisdropped - ) pr_a (attrelid, attname, grantor, grantee, prtype, grantable), - pg_class c - WHERE pr_a.attrelid = c.oid - AND relkind IN ('r', 'v', 'f') - ) x, - pg_namespace nc, - pg_authid u_grantor, - ( - SELECT oid, rolname FROM pg_authid - UNION ALL - SELECT 0::oid, 'PUBLIC' - ) AS grantee (oid, rolname) - - WHERE x.relnamespace = nc.oid - AND x.grantee = grantee.oid - AND x.grantor = u_grantor.oid - AND x.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'REFERENCES', 'COMMENT') - AND (pg_has_role(u_grantor.oid, 'USAGE') - OR pg_has_role(grantee.oid, 'USAGE') - OR grantee.rolname = 'PUBLIC'); - -CREATE VIEW information_schema.column_udt_usage AS - SELECT CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(coalesce(nbt.nspname, nt.nspname) AS sql_identifier) AS udt_schema, - CAST(coalesce(bt.typname, t.typname) AS sql_identifier) AS udt_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_attribute a, pg_class c, pg_namespace nc, - (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) - ON (t.typtype = 'd' AND t.typbasetype = bt.oid) - - WHERE a.attrelid = c.oid - AND a.atttypid = t.oid - AND nc.oid = c.relnamespace - AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v', 'f') - AND pg_has_role(coalesce(bt.typowner, t.typowner), 'USAGE'); - -CREATE VIEW information_schema.columns AS - SELECT CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name, - CAST(a.attnum AS cardinal_number) AS ordinal_position, - CAST(pg_get_expr(ad.adbin, ad.adrelid) AS character_data) AS column_default, - CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END - AS yes_or_no) - AS is_nullable, - - CAST( - CASE WHEN t.typtype = 'd' THEN - CASE WHEN bt.typelem <> 0 AND bt.typlen = -1 THEN 'ARRAY' - WHEN nbt.nspname = 'pg_catalog' THEN format_type(t.typbasetype, null) - ELSE 'USER-DEFINED' END - ELSE - CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY' - WHEN nt.nspname = 'pg_catalog' THEN format_type(a.atttypid, null) - ELSE 'USER-DEFINED' END - END - AS character_data) - AS data_type, - - CAST( - _pg_char_max_length(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS character_maximum_length, - - CAST( - _pg_char_octet_length(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS character_octet_length, - - CAST( - _pg_numeric_precision(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_precision, - - CAST( - _pg_numeric_precision_radix(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_precision_radix, - - CAST( - _pg_numeric_scale(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_scale, - - CAST( - _pg_datetime_precision(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS datetime_precision, - - CAST( - _pg_interval_type(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS character_data) - AS interval_type, - CAST(null AS cardinal_number) AS interval_precision, - - CAST(null AS sql_identifier) AS character_set_catalog, - CAST(null AS sql_identifier) AS character_set_schema, - CAST(null AS sql_identifier) AS character_set_name, - - CAST(CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS sql_identifier) AS collation_catalog, - CAST(nco.nspname AS sql_identifier) AS collation_schema, - CAST(co.collname AS sql_identifier) AS collation_name, - - CAST(CASE WHEN t.typtype = 'd' THEN current_database() ELSE null END - AS sql_identifier) AS domain_catalog, - CAST(CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE null END - AS sql_identifier) AS domain_schema, - CAST(CASE WHEN t.typtype = 'd' THEN t.typname ELSE null END - AS sql_identifier) AS domain_name, - - CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(coalesce(nbt.nspname, nt.nspname) AS sql_identifier) AS udt_schema, - CAST(coalesce(bt.typname, t.typname) AS sql_identifier) AS udt_name, - - CAST(null AS sql_identifier) AS scope_catalog, - CAST(null AS sql_identifier) AS scope_schema, - CAST(null AS sql_identifier) AS scope_name, - - CAST(null AS cardinal_number) AS maximum_cardinality, - CAST(a.attnum AS sql_identifier) AS dtd_identifier, - CAST('NO' AS yes_or_no) AS is_self_referencing, - - CAST('NO' AS yes_or_no) AS is_identity, - CAST(null AS character_data) AS identity_generation, - CAST(null AS character_data) AS identity_start, - CAST(null AS character_data) AS identity_increment, - CAST(null AS character_data) AS identity_maximum, - CAST(null AS character_data) AS identity_minimum, - CAST(null AS yes_or_no) AS identity_cycle, - - CAST('NEVER' AS character_data) AS is_generated, - CAST(null AS character_data) AS generation_expression, - - CAST(CASE WHEN c.relkind = 'r' - OR (c.relkind = 'v' - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead) - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_updatable - - FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum) - JOIN (pg_class c JOIN pg_namespace nc ON (c.relnamespace = nc.oid)) ON a.attrelid = c.oid - JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON a.atttypid = t.oid - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) - ON (t.typtype = 'd' AND t.typbasetype = bt.oid) - LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid)) - ON a.attcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default') - - WHERE (NOT pg_is_other_temp_schema(nc.oid)) - - AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v', 'f') - - AND (pg_has_role(c.relowner, 'USAGE') - OR has_column_privilege(c.oid, a.attnum, - 'SELECT, INSERT, UPDATE, REFERENCES')); - -CREATE VIEW information_schema.table_privileges AS - SELECT CAST(u_grantor.rolname AS sql_identifier) AS grantor, - CAST(grantee.rolname AS sql_identifier) AS grantee, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(c.prtype AS character_data) AS privilege_type, - CAST( - CASE WHEN - -- object owner always has grant options - pg_has_role(grantee.oid, c.relowner, 'USAGE') - OR c.grantable - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable, - CAST(CASE WHEN c.prtype = 'SELECT' THEN 'YES' ELSE 'NO' END AS yes_or_no) AS with_hierarchy - - FROM ( - SELECT oid, relname, relnamespace, relkind, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).* FROM pg_class - ) AS c (oid, relname, relnamespace, relkind, relowner, grantor, grantee, prtype, grantable), - pg_namespace nc, - pg_authid u_grantor, - ( - SELECT oid, rolname FROM pg_authid - UNION ALL - SELECT 0::oid, 'PUBLIC' - ) AS grantee (oid, rolname) - - WHERE c.relnamespace = nc.oid - AND c.relkind IN ('r', 'v') - AND c.grantee = grantee.oid - AND c.grantor = u_grantor.oid - AND c.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER' , - 'ALTER', 'DROP', 'COMMENT', 'INDEX', 'VACUUM') - AND (pg_has_role(u_grantor.oid, 'USAGE') - OR pg_has_role(grantee.oid, 'USAGE') - OR grantee.rolname = 'PUBLIC'); - -CREATE VIEW information_schema.tables AS - SELECT CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - - CAST( - CASE WHEN nc.oid = pg_my_temp_schema() THEN 'LOCAL TEMPORARY' - WHEN c.relkind = 'r' THEN 'BASE TABLE' - WHEN c.relkind = 'v' THEN 'VIEW' - WHEN c.relkind = 'f' THEN 'FOREIGN TABLE' - ELSE null END - AS character_data) AS table_type, - - CAST(null AS sql_identifier) AS self_referencing_column_name, - CAST(null AS character_data) AS reference_generation, - - CAST(CASE WHEN t.typname IS NOT NULL THEN current_database() ELSE null END AS sql_identifier) AS user_defined_type_catalog, - CAST(nt.nspname AS sql_identifier) AS user_defined_type_schema, - CAST(t.typname AS sql_identifier) AS user_defined_type_name, - - CAST(CASE WHEN c.relkind = 'r' - OR (c.relkind = 'v' - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_insertable_into, - - CAST(CASE WHEN t.typname IS NOT NULL THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_typed, - CAST(null AS character_data) AS commit_action - - FROM pg_namespace nc JOIN pg_class c ON (nc.oid = c.relnamespace) - LEFT JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON (c.reloftype = t.oid) - - WHERE c.relkind IN ('r', 'v', 'f') - AND (NOT pg_is_other_temp_schema(nc.oid)) - AND (pg_has_role(c.relowner, 'USAGE') - OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') - OR has_any_column_privilege(c.oid, 'SELECT, INSERT, UPDATE, REFERENCES') ); - -CREATE VIEW information_schema.view_column_usage AS - SELECT DISTINCT - CAST(current_database() AS sql_identifier) AS view_catalog, - CAST(nv.nspname AS sql_identifier) AS view_schema, - CAST(v.relname AS sql_identifier) AS view_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nt.nspname AS sql_identifier) AS table_schema, - CAST(t.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_namespace nv, pg_class v, pg_depend dv, - pg_depend dt, pg_class t, pg_namespace nt, - pg_attribute a - - WHERE nv.oid = v.relnamespace - AND v.relkind = 'v' - AND v.oid = dv.refobjid - AND dv.refclassid = 'pg_catalog.pg_class'::regclass - AND dv.classid = 'pg_catalog.pg_rewrite'::regclass - AND dv.deptype = 'i' - AND dv.objid = dt.objid - AND dv.refobjid <> dt.refobjid - AND dt.classid = 'pg_catalog.pg_rewrite'::regclass - AND dt.refclassid = 'pg_catalog.pg_class'::regclass - AND dt.refobjid = t.oid - AND t.relnamespace = nt.oid - AND t.relkind IN ('r', 'v', 'f') - AND t.oid = a.attrelid - AND dt.refobjsubid = a.attnum - AND pg_has_role(t.relowner, 'USAGE'); - -CREATE VIEW information_schema.view_table_usage AS - SELECT DISTINCT - CAST(current_database() AS sql_identifier) AS view_catalog, - CAST(nv.nspname AS sql_identifier) AS view_schema, - CAST(v.relname AS sql_identifier) AS view_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nt.nspname AS sql_identifier) AS table_schema, - CAST(t.relname AS sql_identifier) AS table_name - - FROM pg_namespace nv, pg_class v, pg_depend dv, - pg_depend dt, pg_class t, pg_namespace nt - - WHERE nv.oid = v.relnamespace - AND v.relkind = 'v' - AND v.oid = dv.refobjid - AND dv.refclassid = 'pg_catalog.pg_class'::regclass - AND dv.classid = 'pg_catalog.pg_rewrite'::regclass - AND dv.deptype = 'i' - AND dv.objid = dt.objid - AND dv.refobjid <> dt.refobjid - AND dt.classid = 'pg_catalog.pg_rewrite'::regclass - AND dt.refclassid = 'pg_catalog.pg_class'::regclass - AND dt.refobjid = t.oid - AND t.relnamespace = nt.oid - AND t.relkind IN ('r', 'v', 'f') - AND pg_has_role(t.relowner, 'USAGE'); - -CREATE VIEW information_schema.data_type_privileges AS - SELECT CAST(current_database() AS sql_identifier) AS object_catalog, - CAST(x.objschema AS sql_identifier) AS object_schema, - CAST(x.objname AS sql_identifier) AS object_name, - CAST(x.objtype AS character_data) AS object_type, - CAST(x.objdtdid AS sql_identifier) AS dtd_identifier - - FROM - ( - SELECT udt_schema, udt_name, 'USER-DEFINED TYPE'::text, dtd_identifier FROM attributes - UNION ALL - SELECT table_schema, table_name, 'TABLE'::text, dtd_identifier FROM columns - UNION ALL - SELECT domain_schema, domain_name, 'DOMAIN'::text, dtd_identifier FROM domains - UNION ALL - SELECT specific_schema, specific_name, 'ROUTINE'::text, dtd_identifier FROM parameters - UNION ALL - SELECT specific_schema, specific_name, 'ROUTINE'::text, dtd_identifier FROM routines - ) AS x (objschema, objname, objtype, objdtdid); - -CREATE VIEW information_schema.role_column_grants AS - SELECT grantor, - grantee, - table_catalog, - table_schema, - table_name, - column_name, - privilege_type, - is_grantable - FROM column_privileges - WHERE grantor IN (SELECT role_name FROM enabled_roles) - OR grantee IN (SELECT role_name FROM enabled_roles); - -CREATE VIEW information_schema.role_table_grants AS - SELECT grantor, - grantee, - table_catalog, - table_schema, - table_name, - privilege_type, - is_grantable, - with_hierarchy - FROM table_privileges - WHERE grantor IN (SELECT role_name FROM enabled_roles) - OR grantee IN (SELECT role_name FROM enabled_roles); - -CREATE VIEW information_schema.element_types AS - SELECT CAST(current_database() AS sql_identifier) AS object_catalog, - CAST(n.nspname AS sql_identifier) AS object_schema, - CAST(x.objname AS sql_identifier) AS object_name, - CAST(x.objtype AS character_data) AS object_type, - CAST(x.objdtdid AS sql_identifier) AS collection_type_identifier, - CAST( - CASE WHEN nbt.nspname = 'pg_catalog' THEN format_type(bt.oid, null) - ELSE 'USER-DEFINED' END AS character_data) AS data_type, - - CAST(null AS cardinal_number) AS character_maximum_length, - CAST(null AS cardinal_number) AS character_octet_length, - CAST(null AS sql_identifier) AS character_set_catalog, - CAST(null AS sql_identifier) AS character_set_schema, - CAST(null AS sql_identifier) AS character_set_name, - CAST(CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS sql_identifier) AS collation_catalog, - CAST(nco.nspname AS sql_identifier) AS collation_schema, - CAST(co.collname AS sql_identifier) AS collation_name, - CAST(null AS cardinal_number) AS numeric_precision, - CAST(null AS cardinal_number) AS numeric_precision_radix, - CAST(null AS cardinal_number) AS numeric_scale, - CAST(null AS cardinal_number) AS datetime_precision, - CAST(null AS character_data) AS interval_type, - CAST(null AS cardinal_number) AS interval_precision, - - CAST(null AS character_data) AS domain_default, -- XXX maybe a bug in the standard - - CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(nbt.nspname AS sql_identifier) AS udt_schema, - CAST(bt.typname AS sql_identifier) AS udt_name, - - CAST(null AS sql_identifier) AS scope_catalog, - CAST(null AS sql_identifier) AS scope_schema, - CAST(null AS sql_identifier) AS scope_name, - - CAST(null AS cardinal_number) AS maximum_cardinality, - CAST('a' || CAST(x.objdtdid AS text) AS sql_identifier) AS dtd_identifier - - FROM pg_namespace n, pg_type at, pg_namespace nbt, pg_type bt, - ( - /* columns, attributes */ - SELECT c.relnamespace, CAST(c.relname AS sql_identifier), - CASE WHEN c.relkind = 'c' THEN 'USER-DEFINED TYPE'::text ELSE 'TABLE'::text END, - a.attnum, a.atttypid, a.attcollation - FROM pg_class c, pg_attribute a - WHERE c.oid = a.attrelid - AND c.relkind IN ('r', 'v', 'f', 'c') - AND attnum > 0 AND NOT attisdropped - - UNION ALL - - /* domains */ - SELECT t.typnamespace, CAST(t.typname AS sql_identifier), - 'DOMAIN'::text, 1, t.typbasetype, t.typcollation - FROM pg_type t - WHERE t.typtype = 'd' - - UNION ALL - - /* parameters */ - SELECT pronamespace, CAST(proname || '_' || CAST(oid AS text) AS sql_identifier), - 'ROUTINE'::text, (ss.x).n, (ss.x).x, 0 - FROM (SELECT p.pronamespace, p.proname, p.oid, - _pg_expandarray(coalesce(p.proallargtypes, p.proargtypes::oid[])) AS x - FROM pg_proc p) AS ss - - UNION ALL - - /* result types */ - SELECT p.pronamespace, CAST(p.proname || '_' || CAST(p.oid AS text) AS sql_identifier), - 'ROUTINE'::text, 0, p.prorettype, 0 - FROM pg_proc p - - ) AS x (objschema, objname, objtype, objdtdid, objtypeid, objcollation) - LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid)) - ON x.objcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default') - - WHERE n.oid = x.objschema - AND at.oid = x.objtypeid - AND (at.typelem <> 0 AND at.typlen = -1) - AND at.typelem = bt.oid - AND nbt.oid = bt.typnamespace - - AND (n.nspname, x.objname, x.objtype, CAST(x.objdtdid AS sql_identifier)) IN - ( SELECT object_schema, object_name, object_type, dtd_identifier - FROM data_type_privileges ); - - -GRANT SELECT ON information_schema.element_types TO PUBLIC; -GRANT SELECT ON information_schema.data_type_privileges TO PUBLIC; -GRANT SELECT ON information_schema.role_column_grants TO PUBLIC; -GRANT SELECT ON information_schema.role_table_grants TO PUBLIC; -GRANT SELECT ON information_schema.column_domain_usage TO PUBLIC; -GRANT SELECT ON information_schema.column_privileges TO PUBLIC; -GRANT SELECT ON information_schema.column_udt_usage TO PUBLIC; -GRANT SELECT ON information_schema.columns TO PUBLIC; -GRANT SELECT ON information_schema.table_privileges TO PUBLIC; -GRANT SELECT ON information_schema.tables TO PUBLIC; -GRANT SELECT ON information_schema.view_column_usage TO PUBLIC; -GRANT SELECT ON information_schema.view_table_usage TO PUBLIC; - -RESET search_path; diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_421.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_421.sql deleted file mode 100644 index be46e8a6e..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_421.sql +++ /dev/null @@ -1,5 +0,0 @@ --- -------------------------------------------------------------- --- rollback pg_catalog.pg_collation --- -------------------------------------------------------------- -delete from pg_catalog.pg_collation where collname='zh_CN' and collnamespace=11 and collencoding=36 and collcollate='zh_CN.gb18030' and collctype='zh_CN.gb18030'; -delete from pg_catalog.pg_collation where collname='zh_CN.gb18030' and collnamespace=11 and collencoding=36 and collcollate='zh_CN.gb18030' and collctype='zh_CN.gb18030'; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_422.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_422.sql deleted file mode 100644 index d41efbeb1..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_422.sql +++ /dev/null @@ -1,18 +0,0 @@ --- -------------------------------------------------------------- --- rollback pg_catalog.pg_buffercache_pages --- -------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.pg_buffercache_pages() CASCADE; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4130; -CREATE OR REPLACE FUNCTION pg_catalog.pg_buffercache_pages -(out bufferid pg_catalog.int4, -out relfilenode pg_catalog.oid, -out bucketid pg_catalog.int2, -out storage_type pg_catalog.int2, -out reltablespace pg_catalog.oid, -out reldatabase pg_catalog.oid, -out relforknumber pg_catalog.int2, -out relblocknumber pg_catalog.int8, -out isdirty pg_catalog.bool, -out usage_count pg_catalog.int2) -RETURNS SETOF record LANGUAGE INTERNAL STABLE STRICT as 'pg_buffercache_pages'; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_424.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_424.sql deleted file mode 100644 index 36dafafbf..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_424.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP FUNCTION IF EXISTS pg_catalog.pg_read_binary_file_blocks(IN inputpath text, IN startblocknum int8, IN count int8) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gs_read_block_from_remote(int4, int4, int4, int2, int2, int4, xid, int4, xid, boolean) CASCADE; diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_425.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_425.sql deleted file mode 100644 index 1e89ec93c..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_425.sql +++ /dev/null @@ -1,13 +0,0 @@ --- deleting system table pg_publication - -DROP INDEX IF EXISTS pg_catalog.pg_publication_oid_index; -DROP INDEX IF EXISTS pg_catalog.pg_publication_pubname_index; -DROP TYPE IF EXISTS pg_catalog.pg_publication; -DROP TABLE IF EXISTS pg_catalog.pg_publication; - --- deleting system table pg_publication_rel - -DROP INDEX IF EXISTS pg_catalog.pg_publication_rel_oid_index; -DROP INDEX IF EXISTS pg_catalog.pg_publication_rel_map_index; -DROP TYPE IF EXISTS pg_catalog.pg_publication_rel; -DROP TABLE IF EXISTS pg_catalog.pg_publication_rel; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_506.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_506.sql new file mode 100644 index 000000000..dc7f26cd9 --- /dev/null +++ b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_506.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS pg_catalog.pg_proc_proname_args_nsp_new_index; diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_507.sql b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_507.sql index 182a48d8f..ef5372823 100644 --- a/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_507.sql +++ b/src/include/catalog/upgrade_sql/rollback_catalog_maindb/rollback_catalog_maindb_92_507.sql @@ -779,7 +779,7 @@ BEGIN END$$; DROP SCHEMA IF EXISTS dbe_pldeveloper; -DROP TYPE IF EXISTS pg_catalog.bulk_exception CASCADE;DROP INDEX IF EXISTS pg_catalog.pg_proc_proname_args_nsp_new_index; +DROP TYPE IF EXISTS pg_catalog.bulk_exception CASCADE; -- ---------------------------------------------------------------- -- rollback pg_catalog.pg_conversion -- ---------------------------------------------------------------- diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_420.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_420.sql deleted file mode 100644 index b931b2c1a..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_420.sql +++ /dev/null @@ -1,275 +0,0 @@ --------------------------------------------------------------- --- delete pg_amop --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Delete_pg_amop_temp() -RETURNS void -AS $$ -DECLARE -row_name record; -query_str text; -query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - delete from pg_catalog.pg_amop where amopfamily in (4033, 4034, 4035, 4036, 4037); - END LOOP; -return; -END; -$$ LANGUAGE 'plpgsql'; - -SELECT Delete_pg_amop_temp(); -DROP FUNCTION Delete_pg_amop_temp(); - - --------------------------------------------------------------- --- delete pg_amproc --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Delete_pg_amproc_temp() -RETURNS void -AS $$ -DECLARE -row_name record; -query_str text; -query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - delete from pg_catalog.pg_amproc where amprocfamily in (4033, 4034, 4035, 4036, 4037); - END LOOP; -return; -END; -$$ LANGUAGE 'plpgsql'; - -SELECT Delete_pg_amproc_temp(); -DROP FUNCTION Delete_pg_amproc_temp(); - - --------------------------------------------------------------- --- delete pg_opclass --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Delete_pg_opclass_temp() -RETURNS void -AS $$ -DECLARE -row_name record; -query_str text; -query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - delete from pg_catalog.pg_opclass where opcfamily in (4033, 4034, 4035, 4036, 4037); - END LOOP; -return; -END; -$$ LANGUAGE 'plpgsql'; - -SELECT Delete_pg_opclass_temp(); -DROP FUNCTION Delete_pg_opclass_temp(); - - --------------------------------------------------------------- --- delete pg_cast --------------------------------------------------------------- -DO $$ -DECLARE -ans boolean; -BEGIN - select case when count(*)=1 then true else false end as ans from (select * from pg_type where typname = 'jsonb' limit 1) into ans; - if ans = true then - DROP CAST IF EXISTS (json AS jsonb) CASCADE; - DROP CAST IF EXISTS (jsonb AS json) CASCADE; - end if; -END$$; - - --------------------------------------------------------------- --- delete pg_opfamily --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Delete_pg_opfamily_temp() -RETURNS void -AS $$ -DECLARE -row_name record; -query_str text; -query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - delete from pg_catalog.pg_opfamily where oid in (4033, 4034, 4035, 4036, 4037); - END LOOP; -return; -END; -$$ LANGUAGE 'plpgsql'; - -SELECT Delete_pg_opfamily_temp(); -DROP FUNCTION Delete_pg_opfamily_temp(); - - --------------------------------------------------------------- --- delete pg_operator --------------------------------------------------------------- -DROP OPERATOR IF EXISTS pg_catalog.->(json, text) cascade; -DROP OPERATOR IF EXISTS pg_catalog.->>(json, text) cascade; -DROP OPERATOR IF EXISTS pg_catalog.->(json, integer) cascade; -DROP OPERATOR IF EXISTS pg_catalog.->>(json, integer) cascade; -DROP OPERATOR IF EXISTS pg_catalog.#>(json, _text) cascade; -DROP OPERATOR IF EXISTS pg_catalog.#>>(json, _text) cascade; - -DO $$ -DECLARE -ans boolean; -BEGIN - select case when count(*)=1 then true else false end as ans from (select * from pg_type where typname = 'jsonb' limit 1) into ans; - if ans = true then - DROP OPERATOR IF EXISTS pg_catalog.->(jsonb, text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.->>(jsonb, text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.->(jsonb, integer) cascade; - DROP OPERATOR IF EXISTS pg_catalog.->>(jsonb, integer) cascade; - DROP OPERATOR IF EXISTS pg_catalog.#>(jsonb, _text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.#>>(jsonb, _text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.=(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.<>(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.<(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.>(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.<=(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.>=(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.@>(jsonb, jsonb) cascade; - DROP OPERATOR IF EXISTS pg_catalog.?(jsonb, text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.?|(jsonb, _text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.?&(jsonb, _text) cascade; - DROP OPERATOR IF EXISTS pg_catalog.<@(jsonb, jsonb) cascade; - end if; -END$$; - - --------------------------------------------------------------- --- delete builtin funcs --------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.gin_compare_jsonb(text, text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_consistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_consistent_jsonb_hash(internal, smallint, anyarray, integer, internal, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb(internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_hash(internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_query(anyarray, internal, smallint, internal, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_query_hash(anyarray, internal, smallint, internal, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_triconsistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gin_triconsistent_jsonb_hash(internal, smallint, anyarray, integer, internal, internal, internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_element(json, integer) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_element_text(json, integer) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_elements(from_json json, OUT value json) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_elements_text(from_json json, OUT value text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_array_length(json) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_build_array() CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_build_array(VARIADIC "any") CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_build_object() CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_build_object(VARIADIC "any") CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_each(from_json json, OUT key text, OUT value json) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_each_text(from_json json, OUT key text, OUT value text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path(json, VARIADIC text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_op(json, text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_text(json, VARIADIC text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_text_op(json, text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object(text[], text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object(text[]) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object_field(json, text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object_field_text(json, text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object_keys(json) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_populate_record(anyelement, json, boolean) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_populate_recordset(anyelement, json, boolean) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_to_record(json, boolean) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_to_recordset(json, boolean) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.to_json(anyelement) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_typeof(json) CASCADE; - -DO $$ -DECLARE -ans boolean; -BEGIN - select case when count(*)=1 then true else false end as ans from (select * from pg_type where typname = 'jsonb' limit 1) into ans; - if ans = true then - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_element(jsonb, integer) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_element_text(jsonb, integer) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_elements(from_json jsonb, OUT value jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_elements_text(from_json jsonb, OUT value text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_length(jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_cmp(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_contained(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_contains(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_each(from_json jsonb, OUT key text, OUT value jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_each_text(from_json jsonb, OUT key text, OUT value text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_eq(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists(jsonb, text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists_all(jsonb, text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists_any(jsonb, text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path(jsonb, VARIADIC text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_op(jsonb, text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_text(jsonb, VARIADIC text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_text_op(jsonb, text[]) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_ge(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_gt(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_hash(jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_le(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_lt(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_ne(jsonb, jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_field(jsonb, text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_field_text(jsonb, text) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_keys(jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_populate_record(anyelement, jsonb, boolean) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_populate_recordset(anyelement, jsonb, boolean) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_typeof(jsonb) CASCADE; - end if; -END$$; ----------------------------------------------------------------- --- recover funcs ----------------------------------------------------------------- -ALTER FUNCTION json_in(cstring) STABLE; -ALTER FUNCTION json_send(json) STABLE; -ALTER FUNCTION json_recv(internal) STABLE; - ----------------------------------------------------------------- --- delete two agg funcs ----------------------------------------------------------------- -drop aggregate if exists pg_catalog.json_object_agg("any", "any"); -DROP FUNCTION IF EXISTS pg_catalog.json_object_agg_finalfn(internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_object_agg_transfn(internal, "any", "any") CASCADE; - -drop aggregate if exists pg_catalog.json_agg(anyelement); -DROP FUNCTION IF EXISTS pg_catalog.json_agg_finalfn(internal) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.json_agg_transfn(internal, anyelement) CASCADE; - - --------------------------------------------------------------- --- delete type jsonb --------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.jsonb_in(cstring) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.jsonb_recv(internal) CASCADE; -DO $$ -DECLARE -ans boolean; -BEGIN - select case when count(*)=1 then true else false end as ans from (select * from pg_type where typname = 'jsonb' limit 1) into ans; - if ans = true then - DROP FUNCTION IF EXISTS pg_catalog.jsonb_out(jsonb) CASCADE; - DROP FUNCTION IF EXISTS pg_catalog.jsonb_send(jsonb) CASCADE; - end if; -END$$; - -DROP TYPE IF EXISTS pg_catalog.jsonb; -DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT encrypt_result_str text) CASCADE;UPDATE pg_catalog.pg_am set amcanunique = FALSE where amname = 'cbtree'; -CREATE OR REPLACE VIEW pg_catalog.gs_session_cpu_statistics AS -SELECT - S.datid AS datid, - S.usename, - S.pid, - S.query_start AS start_time, - T.min_cpu_time, - T.max_cpu_time, - T.total_cpu_time, - S.query, - S.node_group, - T.top_cpu_dn -FROM pg_stat_activity_ng AS S, pg_stat_get_wlm_realtime_session_info(NULL) AS T -WHERE S.pid = T.threadid; diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_425.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_425.sql deleted file mode 100644 index 722d7283a..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback-post_catalog_otherdb_92_425.sql +++ /dev/null @@ -1,60 +0,0 @@ --- deleting system view -DROP VIEW IF EXISTS pg_catalog.pg_publication_tables; -DROP VIEW IF EXISTS pg_catalog.pg_stat_subscription; -DROP VIEW IF EXISTS pg_catalog.pg_replication_origin_status; - --- deleting function pg_replication_origin_create -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_create(IN node_name text, OUT replication_origin_oid oid) CASCADE; - --- deleting function pg_replication_origin_drop -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_drop(IN node_name text, OUT replication_origin_oid oid) CASCADE; - --- deleting function pg_replication_origin_oid -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_oid(IN node_name text, OUT replication_origin_oid oid) CASCADE; - --- deleting function pg_replication_origin_session_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_setup(IN node_name text) CASCADE; - --- deleting function pg_replication_origin_session_reset -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_reset() CASCADE; - --- deleting function pg_replication_origin_session_is_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_is_setup() CASCADE; - --- deleting function pg_replication_origin_session_progress -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_progress(IN flush boolean) CASCADE; - --- deleting function pg_replication_origin_xact_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_xact_setup(IN origin_lsn text, IN origin_timestamp timestamp with time zone) CASCADE; - --- deleting function pg_replication_origin_xact_reset -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_xact_reset() CASCADE; - --- deleting function pg_replication_origin_advance -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_advance(IN node_name text, IN lsn text) CASCADE; - --- deleting function pg_replication_origin_progress -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_progress(IN node_name text, IN flush boolean) CASCADE; - --- deleting function pg_show_replication_origin_status -DROP FUNCTION IF EXISTS pg_catalog.pg_show_replication_origin_status(OUT local_id oid, OUT external_id text, OUT remote_lsn text, OUT local_lsn text) CASCADE; - --- deleting function pg_get_publication_tables -DROP FUNCTION IF EXISTS pg_catalog.pg_get_publication_tables(IN pubname text, OUT relid oid) CASCADE; - --- deleting function pg_stat_get_subscription -DROP FUNCTION IF EXISTS pg_catalog.pg_stat_get_subscription(IN subid oid, OUT subid oid, OUT pid integer, OUT received_lsn text, OUT last_msg_send_time timestamp with time zone, OUT last_msg_receipt_time timestamp with time zone, OUT latest_end_lsn text, OUT latest_end_time timestamp with time zone) CASCADE; - --- deleting system table pg_subscription - -DROP INDEX IF EXISTS pg_catalog.pg_subscription_oid_index; -DROP INDEX IF EXISTS pg_catalog.pg_subscription_subname_index; -DROP TYPE IF EXISTS pg_catalog.pg_subscription; -DROP TABLE IF EXISTS pg_catalog.pg_subscription; - --- deleting system table pg_replication_origin - -DROP INDEX IF EXISTS pg_catalog.pg_replication_origin_roident_index; -DROP INDEX IF EXISTS pg_catalog.pg_replication_origin_roname_index; -DROP TYPE IF EXISTS pg_catalog.pg_replication_origin; -DROP TABLE IF EXISTS pg_catalog.pg_replication_origin; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_420.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_420.sql deleted file mode 100644 index 489bbb5cb..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_420.sql +++ /dev/null @@ -1,529 +0,0 @@ -SET search_path TO information_schema; - --- element_types is generated by data_type_privileges -DROP VIEW IF EXISTS information_schema.element_types CASCADE; - --- data_type_privileges is generated by columns -DROP VIEW IF EXISTS information_schema.data_type_privileges CASCADE; --- data_type_privileges is generated by table_privileges -DROP VIEW IF EXISTS information_schema.role_column_grants CASCADE; --- data_type_privileges is generated by column_privileges -DROP VIEW IF EXISTS information_schema.role_table_grants CASCADE; - --- other views need upgrade for matview -DROP VIEW IF EXISTS information_schema.column_domain_usage CASCADE; -DROP VIEW IF EXISTS information_schema.column_privileges CASCADE; -DROP VIEW IF EXISTS information_schema.column_udt_usage CASCADE; -DROP VIEW IF EXISTS information_schema.columns CASCADE; -DROP VIEW IF EXISTS information_schema.table_privileges CASCADE; -DROP VIEW IF EXISTS information_schema.tables CASCADE; -DROP VIEW IF EXISTS information_schema.view_column_usage CASCADE; -DROP VIEW IF EXISTS information_schema.view_table_usage CASCADE; - -CREATE VIEW information_schema.column_domain_usage AS - SELECT CAST(current_database() AS sql_identifier) AS domain_catalog, - CAST(nt.nspname AS sql_identifier) AS domain_schema, - CAST(t.typname AS sql_identifier) AS domain_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_type t, pg_namespace nt, pg_class c, pg_namespace nc, - pg_attribute a - - WHERE t.typnamespace = nt.oid - AND c.relnamespace = nc.oid - AND a.attrelid = c.oid - AND a.atttypid = t.oid - AND t.typtype = 'd' - AND c.relkind IN ('r', 'v', 'f') - AND a.attnum > 0 - AND NOT a.attisdropped - AND pg_has_role(t.typowner, 'USAGE'); - -CREATE VIEW information_schema.column_privileges AS - SELECT CAST(u_grantor.rolname AS sql_identifier) AS grantor, - CAST(grantee.rolname AS sql_identifier) AS grantee, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(x.relname AS sql_identifier) AS table_name, - CAST(x.attname AS sql_identifier) AS column_name, - CAST(x.prtype AS character_data) AS privilege_type, - CAST( - CASE WHEN - -- object owner always has grant options - pg_has_role(x.grantee, x.relowner, 'USAGE') - OR x.grantable - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable - - FROM ( - SELECT pr_c.grantor, - pr_c.grantee, - attname, - relname, - relnamespace, - pr_c.prtype, - pr_c.grantable, - pr_c.relowner - FROM (SELECT oid, relname, relnamespace, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).* - FROM pg_class - WHERE relkind IN ('r', 'v', 'f') - ) pr_c (oid, relname, relnamespace, relowner, grantor, grantee, prtype, grantable), - pg_attribute a - WHERE a.attrelid = pr_c.oid - AND a.attnum > 0 - AND NOT a.attisdropped - UNION - SELECT pr_a.grantor, - pr_a.grantee, - attname, - relname, - relnamespace, - pr_a.prtype, - pr_a.grantable, - c.relowner - FROM (SELECT attrelid, attname, (aclexplode(coalesce(attacl, acldefault('c', relowner)))).* - FROM pg_attribute a JOIN pg_class cc ON (a.attrelid = cc.oid) - WHERE attnum > 0 - AND NOT attisdropped - ) pr_a (attrelid, attname, grantor, grantee, prtype, grantable), - pg_class c - WHERE pr_a.attrelid = c.oid - AND relkind IN ('r', 'v', 'f') - ) x, - pg_namespace nc, - pg_authid u_grantor, - ( - SELECT oid, rolname FROM pg_authid - UNION ALL - SELECT 0::oid, 'PUBLIC' - ) AS grantee (oid, rolname) - - WHERE x.relnamespace = nc.oid - AND x.grantee = grantee.oid - AND x.grantor = u_grantor.oid - AND x.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'REFERENCES', 'COMMENT') - AND (pg_has_role(u_grantor.oid, 'USAGE') - OR pg_has_role(grantee.oid, 'USAGE') - OR grantee.rolname = 'PUBLIC'); - -CREATE VIEW information_schema.column_udt_usage AS - SELECT CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(coalesce(nbt.nspname, nt.nspname) AS sql_identifier) AS udt_schema, - CAST(coalesce(bt.typname, t.typname) AS sql_identifier) AS udt_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_attribute a, pg_class c, pg_namespace nc, - (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) - ON (t.typtype = 'd' AND t.typbasetype = bt.oid) - - WHERE a.attrelid = c.oid - AND a.atttypid = t.oid - AND nc.oid = c.relnamespace - AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v', 'f') - AND pg_has_role(coalesce(bt.typowner, t.typowner), 'USAGE'); - -CREATE VIEW information_schema.columns AS - SELECT CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name, - CAST(a.attnum AS cardinal_number) AS ordinal_position, - CAST(pg_get_expr(ad.adbin, ad.adrelid) AS character_data) AS column_default, - CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END - AS yes_or_no) - AS is_nullable, - - CAST( - CASE WHEN t.typtype = 'd' THEN - CASE WHEN bt.typelem <> 0 AND bt.typlen = -1 THEN 'ARRAY' - WHEN nbt.nspname = 'pg_catalog' THEN format_type(t.typbasetype, null) - ELSE 'USER-DEFINED' END - ELSE - CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY' - WHEN nt.nspname = 'pg_catalog' THEN format_type(a.atttypid, null) - ELSE 'USER-DEFINED' END - END - AS character_data) - AS data_type, - - CAST( - _pg_char_max_length(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS character_maximum_length, - - CAST( - _pg_char_octet_length(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS character_octet_length, - - CAST( - _pg_numeric_precision(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_precision, - - CAST( - _pg_numeric_precision_radix(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_precision_radix, - - CAST( - _pg_numeric_scale(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_scale, - - CAST( - _pg_datetime_precision(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS datetime_precision, - - CAST( - _pg_interval_type(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS character_data) - AS interval_type, - CAST(null AS cardinal_number) AS interval_precision, - - CAST(null AS sql_identifier) AS character_set_catalog, - CAST(null AS sql_identifier) AS character_set_schema, - CAST(null AS sql_identifier) AS character_set_name, - - CAST(CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS sql_identifier) AS collation_catalog, - CAST(nco.nspname AS sql_identifier) AS collation_schema, - CAST(co.collname AS sql_identifier) AS collation_name, - - CAST(CASE WHEN t.typtype = 'd' THEN current_database() ELSE null END - AS sql_identifier) AS domain_catalog, - CAST(CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE null END - AS sql_identifier) AS domain_schema, - CAST(CASE WHEN t.typtype = 'd' THEN t.typname ELSE null END - AS sql_identifier) AS domain_name, - - CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(coalesce(nbt.nspname, nt.nspname) AS sql_identifier) AS udt_schema, - CAST(coalesce(bt.typname, t.typname) AS sql_identifier) AS udt_name, - - CAST(null AS sql_identifier) AS scope_catalog, - CAST(null AS sql_identifier) AS scope_schema, - CAST(null AS sql_identifier) AS scope_name, - - CAST(null AS cardinal_number) AS maximum_cardinality, - CAST(a.attnum AS sql_identifier) AS dtd_identifier, - CAST('NO' AS yes_or_no) AS is_self_referencing, - - CAST('NO' AS yes_or_no) AS is_identity, - CAST(null AS character_data) AS identity_generation, - CAST(null AS character_data) AS identity_start, - CAST(null AS character_data) AS identity_increment, - CAST(null AS character_data) AS identity_maximum, - CAST(null AS character_data) AS identity_minimum, - CAST(null AS yes_or_no) AS identity_cycle, - - CAST('NEVER' AS character_data) AS is_generated, - CAST(null AS character_data) AS generation_expression, - - CAST(CASE WHEN c.relkind = 'r' - OR (c.relkind = 'v' - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead) - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_updatable - - FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum) - JOIN (pg_class c JOIN pg_namespace nc ON (c.relnamespace = nc.oid)) ON a.attrelid = c.oid - JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON a.atttypid = t.oid - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) - ON (t.typtype = 'd' AND t.typbasetype = bt.oid) - LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid)) - ON a.attcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default') - - WHERE (NOT pg_is_other_temp_schema(nc.oid)) - - AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'v', 'f') - - AND (pg_has_role(c.relowner, 'USAGE') - OR has_column_privilege(c.oid, a.attnum, - 'SELECT, INSERT, UPDATE, REFERENCES')); - -CREATE VIEW information_schema.table_privileges AS - SELECT CAST(u_grantor.rolname AS sql_identifier) AS grantor, - CAST(grantee.rolname AS sql_identifier) AS grantee, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(c.prtype AS character_data) AS privilege_type, - CAST( - CASE WHEN - -- object owner always has grant options - pg_has_role(grantee.oid, c.relowner, 'USAGE') - OR c.grantable - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable, - CAST(CASE WHEN c.prtype = 'SELECT' THEN 'YES' ELSE 'NO' END AS yes_or_no) AS with_hierarchy - - FROM ( - SELECT oid, relname, relnamespace, relkind, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).* FROM pg_class - ) AS c (oid, relname, relnamespace, relkind, relowner, grantor, grantee, prtype, grantable), - pg_namespace nc, - pg_authid u_grantor, - ( - SELECT oid, rolname FROM pg_authid - UNION ALL - SELECT 0::oid, 'PUBLIC' - ) AS grantee (oid, rolname) - - WHERE c.relnamespace = nc.oid - AND c.relkind IN ('r', 'v') - AND c.grantee = grantee.oid - AND c.grantor = u_grantor.oid - AND c.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER' , - 'ALTER', 'DROP', 'COMMENT', 'INDEX', 'VACUUM') - AND (pg_has_role(u_grantor.oid, 'USAGE') - OR pg_has_role(grantee.oid, 'USAGE') - OR grantee.rolname = 'PUBLIC'); - -CREATE VIEW information_schema.tables AS - SELECT CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - - CAST( - CASE WHEN nc.oid = pg_my_temp_schema() THEN 'LOCAL TEMPORARY' - WHEN c.relkind = 'r' THEN 'BASE TABLE' - WHEN c.relkind = 'v' THEN 'VIEW' - WHEN c.relkind = 'f' THEN 'FOREIGN TABLE' - ELSE null END - AS character_data) AS table_type, - - CAST(null AS sql_identifier) AS self_referencing_column_name, - CAST(null AS character_data) AS reference_generation, - - CAST(CASE WHEN t.typname IS NOT NULL THEN current_database() ELSE null END AS sql_identifier) AS user_defined_type_catalog, - CAST(nt.nspname AS sql_identifier) AS user_defined_type_schema, - CAST(t.typname AS sql_identifier) AS user_defined_type_name, - - CAST(CASE WHEN c.relkind = 'r' - OR (c.relkind = 'v' - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_insertable_into, - - CAST(CASE WHEN t.typname IS NOT NULL THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_typed, - CAST(null AS character_data) AS commit_action - - FROM pg_namespace nc JOIN pg_class c ON (nc.oid = c.relnamespace) - LEFT JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON (c.reloftype = t.oid) - - WHERE c.relkind IN ('r', 'v', 'f') - AND (NOT pg_is_other_temp_schema(nc.oid)) - AND (pg_has_role(c.relowner, 'USAGE') - OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') - OR has_any_column_privilege(c.oid, 'SELECT, INSERT, UPDATE, REFERENCES') ); - -CREATE VIEW information_schema.view_column_usage AS - SELECT DISTINCT - CAST(current_database() AS sql_identifier) AS view_catalog, - CAST(nv.nspname AS sql_identifier) AS view_schema, - CAST(v.relname AS sql_identifier) AS view_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nt.nspname AS sql_identifier) AS table_schema, - CAST(t.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_namespace nv, pg_class v, pg_depend dv, - pg_depend dt, pg_class t, pg_namespace nt, - pg_attribute a - - WHERE nv.oid = v.relnamespace - AND v.relkind = 'v' - AND v.oid = dv.refobjid - AND dv.refclassid = 'pg_catalog.pg_class'::regclass - AND dv.classid = 'pg_catalog.pg_rewrite'::regclass - AND dv.deptype = 'i' - AND dv.objid = dt.objid - AND dv.refobjid <> dt.refobjid - AND dt.classid = 'pg_catalog.pg_rewrite'::regclass - AND dt.refclassid = 'pg_catalog.pg_class'::regclass - AND dt.refobjid = t.oid - AND t.relnamespace = nt.oid - AND t.relkind IN ('r', 'v', 'f') - AND t.oid = a.attrelid - AND dt.refobjsubid = a.attnum - AND pg_has_role(t.relowner, 'USAGE'); - -CREATE VIEW information_schema.view_table_usage AS - SELECT DISTINCT - CAST(current_database() AS sql_identifier) AS view_catalog, - CAST(nv.nspname AS sql_identifier) AS view_schema, - CAST(v.relname AS sql_identifier) AS view_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nt.nspname AS sql_identifier) AS table_schema, - CAST(t.relname AS sql_identifier) AS table_name - - FROM pg_namespace nv, pg_class v, pg_depend dv, - pg_depend dt, pg_class t, pg_namespace nt - - WHERE nv.oid = v.relnamespace - AND v.relkind = 'v' - AND v.oid = dv.refobjid - AND dv.refclassid = 'pg_catalog.pg_class'::regclass - AND dv.classid = 'pg_catalog.pg_rewrite'::regclass - AND dv.deptype = 'i' - AND dv.objid = dt.objid - AND dv.refobjid <> dt.refobjid - AND dt.classid = 'pg_catalog.pg_rewrite'::regclass - AND dt.refclassid = 'pg_catalog.pg_class'::regclass - AND dt.refobjid = t.oid - AND t.relnamespace = nt.oid - AND t.relkind IN ('r', 'v', 'f') - AND pg_has_role(t.relowner, 'USAGE'); - -CREATE VIEW information_schema.data_type_privileges AS - SELECT CAST(current_database() AS sql_identifier) AS object_catalog, - CAST(x.objschema AS sql_identifier) AS object_schema, - CAST(x.objname AS sql_identifier) AS object_name, - CAST(x.objtype AS character_data) AS object_type, - CAST(x.objdtdid AS sql_identifier) AS dtd_identifier - - FROM - ( - SELECT udt_schema, udt_name, 'USER-DEFINED TYPE'::text, dtd_identifier FROM attributes - UNION ALL - SELECT table_schema, table_name, 'TABLE'::text, dtd_identifier FROM columns - UNION ALL - SELECT domain_schema, domain_name, 'DOMAIN'::text, dtd_identifier FROM domains - UNION ALL - SELECT specific_schema, specific_name, 'ROUTINE'::text, dtd_identifier FROM parameters - UNION ALL - SELECT specific_schema, specific_name, 'ROUTINE'::text, dtd_identifier FROM routines - ) AS x (objschema, objname, objtype, objdtdid); - -CREATE VIEW information_schema.role_column_grants AS - SELECT grantor, - grantee, - table_catalog, - table_schema, - table_name, - column_name, - privilege_type, - is_grantable - FROM column_privileges - WHERE grantor IN (SELECT role_name FROM enabled_roles) - OR grantee IN (SELECT role_name FROM enabled_roles); - -CREATE VIEW information_schema.role_table_grants AS - SELECT grantor, - grantee, - table_catalog, - table_schema, - table_name, - privilege_type, - is_grantable, - with_hierarchy - FROM table_privileges - WHERE grantor IN (SELECT role_name FROM enabled_roles) - OR grantee IN (SELECT role_name FROM enabled_roles); - -CREATE VIEW information_schema.element_types AS - SELECT CAST(current_database() AS sql_identifier) AS object_catalog, - CAST(n.nspname AS sql_identifier) AS object_schema, - CAST(x.objname AS sql_identifier) AS object_name, - CAST(x.objtype AS character_data) AS object_type, - CAST(x.objdtdid AS sql_identifier) AS collection_type_identifier, - CAST( - CASE WHEN nbt.nspname = 'pg_catalog' THEN format_type(bt.oid, null) - ELSE 'USER-DEFINED' END AS character_data) AS data_type, - - CAST(null AS cardinal_number) AS character_maximum_length, - CAST(null AS cardinal_number) AS character_octet_length, - CAST(null AS sql_identifier) AS character_set_catalog, - CAST(null AS sql_identifier) AS character_set_schema, - CAST(null AS sql_identifier) AS character_set_name, - CAST(CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS sql_identifier) AS collation_catalog, - CAST(nco.nspname AS sql_identifier) AS collation_schema, - CAST(co.collname AS sql_identifier) AS collation_name, - CAST(null AS cardinal_number) AS numeric_precision, - CAST(null AS cardinal_number) AS numeric_precision_radix, - CAST(null AS cardinal_number) AS numeric_scale, - CAST(null AS cardinal_number) AS datetime_precision, - CAST(null AS character_data) AS interval_type, - CAST(null AS cardinal_number) AS interval_precision, - - CAST(null AS character_data) AS domain_default, -- XXX maybe a bug in the standard - - CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(nbt.nspname AS sql_identifier) AS udt_schema, - CAST(bt.typname AS sql_identifier) AS udt_name, - - CAST(null AS sql_identifier) AS scope_catalog, - CAST(null AS sql_identifier) AS scope_schema, - CAST(null AS sql_identifier) AS scope_name, - - CAST(null AS cardinal_number) AS maximum_cardinality, - CAST('a' || CAST(x.objdtdid AS text) AS sql_identifier) AS dtd_identifier - - FROM pg_namespace n, pg_type at, pg_namespace nbt, pg_type bt, - ( - /* columns, attributes */ - SELECT c.relnamespace, CAST(c.relname AS sql_identifier), - CASE WHEN c.relkind = 'c' THEN 'USER-DEFINED TYPE'::text ELSE 'TABLE'::text END, - a.attnum, a.atttypid, a.attcollation - FROM pg_class c, pg_attribute a - WHERE c.oid = a.attrelid - AND c.relkind IN ('r', 'v', 'f', 'c') - AND attnum > 0 AND NOT attisdropped - - UNION ALL - - /* domains */ - SELECT t.typnamespace, CAST(t.typname AS sql_identifier), - 'DOMAIN'::text, 1, t.typbasetype, t.typcollation - FROM pg_type t - WHERE t.typtype = 'd' - - UNION ALL - - /* parameters */ - SELECT pronamespace, CAST(proname || '_' || CAST(oid AS text) AS sql_identifier), - 'ROUTINE'::text, (ss.x).n, (ss.x).x, 0 - FROM (SELECT p.pronamespace, p.proname, p.oid, - _pg_expandarray(coalesce(p.proallargtypes, p.proargtypes::oid[])) AS x - FROM pg_proc p) AS ss - - UNION ALL - - /* result types */ - SELECT p.pronamespace, CAST(p.proname || '_' || CAST(p.oid AS text) AS sql_identifier), - 'ROUTINE'::text, 0, p.prorettype, 0 - FROM pg_proc p - - ) AS x (objschema, objname, objtype, objdtdid, objtypeid, objcollation) - LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid)) - ON x.objcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default') - - WHERE n.oid = x.objschema - AND at.oid = x.objtypeid - AND (at.typelem <> 0 AND at.typlen = -1) - AND at.typelem = bt.oid - AND nbt.oid = bt.typnamespace - - AND (n.nspname, x.objname, x.objtype, CAST(x.objdtdid AS sql_identifier)) IN - ( SELECT object_schema, object_name, object_type, dtd_identifier - FROM data_type_privileges ); - - -GRANT SELECT ON information_schema.element_types TO PUBLIC; -GRANT SELECT ON information_schema.data_type_privileges TO PUBLIC; -GRANT SELECT ON information_schema.role_column_grants TO PUBLIC; -GRANT SELECT ON information_schema.role_table_grants TO PUBLIC; -GRANT SELECT ON information_schema.column_domain_usage TO PUBLIC; -GRANT SELECT ON information_schema.column_privileges TO PUBLIC; -GRANT SELECT ON information_schema.column_udt_usage TO PUBLIC; -GRANT SELECT ON information_schema.columns TO PUBLIC; -GRANT SELECT ON information_schema.table_privileges TO PUBLIC; -GRANT SELECT ON information_schema.tables TO PUBLIC; -GRANT SELECT ON information_schema.view_column_usage TO PUBLIC; -GRANT SELECT ON information_schema.view_table_usage TO PUBLIC; - -RESET search_path; diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_421.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_421.sql deleted file mode 100644 index be46e8a6e..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_421.sql +++ /dev/null @@ -1,5 +0,0 @@ --- -------------------------------------------------------------- --- rollback pg_catalog.pg_collation --- -------------------------------------------------------------- -delete from pg_catalog.pg_collation where collname='zh_CN' and collnamespace=11 and collencoding=36 and collcollate='zh_CN.gb18030' and collctype='zh_CN.gb18030'; -delete from pg_catalog.pg_collation where collname='zh_CN.gb18030' and collnamespace=11 and collencoding=36 and collcollate='zh_CN.gb18030' and collctype='zh_CN.gb18030'; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_422.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_422.sql deleted file mode 100644 index d41efbeb1..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_422.sql +++ /dev/null @@ -1,18 +0,0 @@ --- -------------------------------------------------------------- --- rollback pg_catalog.pg_buffercache_pages --- -------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.pg_buffercache_pages() CASCADE; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4130; -CREATE OR REPLACE FUNCTION pg_catalog.pg_buffercache_pages -(out bufferid pg_catalog.int4, -out relfilenode pg_catalog.oid, -out bucketid pg_catalog.int2, -out storage_type pg_catalog.int2, -out reltablespace pg_catalog.oid, -out reldatabase pg_catalog.oid, -out relforknumber pg_catalog.int2, -out relblocknumber pg_catalog.int8, -out isdirty pg_catalog.bool, -out usage_count pg_catalog.int2) -RETURNS SETOF record LANGUAGE INTERNAL STABLE STRICT as 'pg_buffercache_pages'; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_424.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_424.sql deleted file mode 100644 index 36dafafbf..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_424.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP FUNCTION IF EXISTS pg_catalog.pg_read_binary_file_blocks(IN inputpath text, IN startblocknum int8, IN count int8) CASCADE; -DROP FUNCTION IF EXISTS pg_catalog.gs_read_block_from_remote(int4, int4, int4, int2, int2, int4, xid, int4, xid, boolean) CASCADE; diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_425.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_425.sql deleted file mode 100644 index 1e89ec93c..000000000 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_425.sql +++ /dev/null @@ -1,13 +0,0 @@ --- deleting system table pg_publication - -DROP INDEX IF EXISTS pg_catalog.pg_publication_oid_index; -DROP INDEX IF EXISTS pg_catalog.pg_publication_pubname_index; -DROP TYPE IF EXISTS pg_catalog.pg_publication; -DROP TABLE IF EXISTS pg_catalog.pg_publication; - --- deleting system table pg_publication_rel - -DROP INDEX IF EXISTS pg_catalog.pg_publication_rel_oid_index; -DROP INDEX IF EXISTS pg_catalog.pg_publication_rel_map_index; -DROP TYPE IF EXISTS pg_catalog.pg_publication_rel; -DROP TABLE IF EXISTS pg_catalog.pg_publication_rel; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_506.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_506.sql new file mode 100644 index 000000000..dc7f26cd9 --- /dev/null +++ b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_506.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS pg_catalog.pg_proc_proname_args_nsp_new_index; diff --git a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_507.sql b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_507.sql index a2cc6e9c0..1c51d10ae 100644 --- a/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_507.sql +++ b/src/include/catalog/upgrade_sql/rollback_catalog_otherdb/rollback_catalog_otherdb_92_507.sql @@ -777,7 +777,7 @@ BEGIN END$$; DROP SCHEMA IF EXISTS dbe_pldeveloper; -DROP TYPE IF EXISTS pg_catalog.bulk_exception CASCADE;DROP INDEX IF EXISTS pg_catalog.pg_proc_proname_args_nsp_new_index; +DROP TYPE IF EXISTS pg_catalog.bulk_exception CASCADE; -- ---------------------------------------------------------------- -- rollback pg_catalog.pg_conversion -- ---------------------------------------------------------------- diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_420.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_420.sql deleted file mode 100644 index 215dd9fc1..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_420.sql +++ /dev/null @@ -1,1418 +0,0 @@ --------------------------------------------------------------- --- add new type jsonb --------------------------------------------------------------- -DROP TYPE IF EXISTS pg_catalog.jsonb; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_TYPE, 3802, 0, b; -CREATE TYPE pg_catalog.jsonb; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_in(cstring) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3806; -CREATE FUNCTION pg_catalog.jsonb_in ( -cstring -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_in'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_out(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3436; -CREATE FUNCTION pg_catalog.jsonb_out ( -jsonb -) RETURNS cstring LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_out'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_send(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3444; -CREATE FUNCTION pg_catalog.jsonb_send ( -jsonb -) RETURNS bytea LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_send'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_recv(internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3443; -CREATE FUNCTION pg_catalog.jsonb_recv ( -internal -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_recv'; - -CREATE TYPE pg_catalog.jsonb (input=jsonb_in, output=jsonb_out, RECEIVE = jsonb_recv, SEND = jsonb_send, STORAGE=EXTENDED, category='C'); -COMMENT ON TYPE pg_catalog.jsonb IS 'json binary'; -COMMENT ON TYPE pg_catalog._jsonb IS 'json binary'; - - ----------------------------------------------------------------- --- add two agg funcs ----------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.json_agg_finalfn(internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3125; -CREATE FUNCTION pg_catalog.json_agg_finalfn ( -internal -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_agg_finalfn'; - -DROP FUNCTION IF EXISTS pg_catalog.json_agg_transfn(internal, anyelement) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3126; -CREATE FUNCTION pg_catalog.json_agg_transfn ( -internal, anyelement -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE as 'json_agg_transfn'; - -drop aggregate if exists pg_catalog.json_agg(anyelement); -SET LOCAL inplace_upgrade_next_system_object_oids=IUO_PROC, 3124; -create aggregate pg_catalog.json_agg(anyelement) (SFUNC=json_agg_transfn, STYPE= internal, finalfunc = json_agg_finalfn); - - -DROP FUNCTION IF EXISTS pg_catalog.json_object_agg_finalfn(internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3404; -CREATE FUNCTION pg_catalog.json_object_agg_finalfn ( -internal -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_object_agg_finalfn'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object_agg_transfn(internal, "any", "any") CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3405; -CREATE FUNCTION pg_catalog.json_object_agg_transfn ( -internal, "any", "any" -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE as 'json_object_agg_transfn'; - -drop aggregate if exists pg_catalog.json_object_agg("any", "any"); -SET LOCAL inplace_upgrade_next_system_object_oids=IUO_PROC, 3403; -create aggregate pg_catalog.json_object_agg("any", "any") (SFUNC=json_object_agg_transfn, STYPE= internal, finalfunc = json_object_agg_finalfn); - - ----------------------------------------------------------------- --- modify normal funcs ----------------------------------------------------------------- -ALTER FUNCTION json_in(cstring) IMMUTABLE; -ALTER FUNCTION json_send(json) IMMUTABLE; -ALTER FUNCTION json_recv(internal) IMMUTABLE; - - ----------------------------------------------------------------- --- add normal funcs ----------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.gin_compare_jsonb(text, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3498; -CREATE FUNCTION pg_catalog.gin_compare_jsonb ( -text, text -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_compare_jsonb'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_consistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3497; -CREATE FUNCTION pg_catalog.gin_consistent_jsonb ( -internal, smallint, anyarray, integer, internal, internal, internal, internal -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_consistent_jsonb'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_consistent_jsonb_hash(internal, smallint, anyarray, integer, internal, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3487; -CREATE FUNCTION pg_catalog.gin_consistent_jsonb_hash ( -internal, smallint, anyarray, integer, internal, internal, internal, internal -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_consistent_jsonb_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb(internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3482; -CREATE FUNCTION pg_catalog.gin_extract_jsonb ( -internal, internal, internal -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_extract_jsonb'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_hash(internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3492; -CREATE FUNCTION pg_catalog.gin_extract_jsonb_hash ( -internal, internal, internal -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_extract_jsonb_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_query(anyarray, internal, smallint, internal, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3493; -CREATE FUNCTION pg_catalog.gin_extract_jsonb_query ( -anyarray, internal, smallint, internal, internal, internal, internal -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_extract_jsonb_query'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_query_hash(anyarray, internal, smallint, internal, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3486; -CREATE FUNCTION pg_catalog.gin_extract_jsonb_query_hash ( -anyarray, internal, smallint, internal, internal, internal, internal -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_extract_jsonb_query_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_triconsistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3494; -CREATE FUNCTION pg_catalog.gin_triconsistent_jsonb ( -internal, smallint, anyarray, integer, internal, internal, internal -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_triconsistent_jsonb'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_triconsistent_jsonb_hash(internal, smallint, anyarray, integer, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3495; -CREATE FUNCTION pg_catalog.gin_triconsistent_jsonb_hash ( -internal, smallint, anyarray, integer, internal, internal, internal -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_triconsistent_jsonb_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_element(json, integer) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3949; -CREATE FUNCTION pg_catalog.json_array_element ( -json, integer -) RETURNS json LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_array_element'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_element_text(json, integer) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3079; -CREATE FUNCTION pg_catalog.json_array_element_text ( -json, integer -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_array_element_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_elements(from_json json, OUT value json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3549; -CREATE FUNCTION pg_catalog.json_array_elements ( -from_json json, OUT value json -) RETURNS SETOF json LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_array_elements'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_elements_text(from_json json, OUT value text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3127; -CREATE FUNCTION pg_catalog.json_array_elements_text ( -from_json json, OUT value text -) RETURNS SETOF text LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_array_elements_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_length(json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3128; -CREATE FUNCTION pg_catalog.json_array_length ( -json -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_array_length'; - -DROP FUNCTION IF EXISTS pg_catalog.json_build_array() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3238; -CREATE FUNCTION pg_catalog.json_build_array ( - -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_build_array_noargs'; - -DROP FUNCTION IF EXISTS pg_catalog.json_build_array(VARIADIC "any") CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3239; -CREATE FUNCTION pg_catalog.json_build_array ( -VARIADIC "any" -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_build_array'; - -DROP FUNCTION IF EXISTS pg_catalog.json_build_object() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3260; -CREATE FUNCTION pg_catalog.json_build_object ( - -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_build_object_noargs'; - -DROP FUNCTION IF EXISTS pg_catalog.json_build_object(VARIADIC "any") CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3261; -CREATE FUNCTION pg_catalog.json_build_object ( -VARIADIC "any" -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_build_object'; - -DROP FUNCTION IF EXISTS pg_catalog.json_each(from_json json, OUT key text, OUT value json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3258; -CREATE FUNCTION pg_catalog.json_each ( -from_json json, OUT key text, OUT value json -) RETURNS SETOF record LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_each'; - -DROP FUNCTION IF EXISTS pg_catalog.json_each_text(from_json json, OUT key text, OUT value text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3259; -CREATE FUNCTION pg_catalog.json_each_text ( -from_json json, OUT key text, OUT value text -) RETURNS SETOF record LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_each_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path(json, VARIADIC text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3262; -CREATE FUNCTION pg_catalog.json_extract_path ( -json, VARIADIC text[] -) RETURNS json LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_extract_path'; - -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_op(json, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3263; -CREATE FUNCTION pg_catalog.json_extract_path_op ( -json, text[] -) RETURNS json LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_extract_path'; - -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_text(json, VARIADIC text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3264; -CREATE FUNCTION pg_catalog.json_extract_path_text ( -json, VARIADIC text[] -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_extract_path_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_text_op(json, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3318; -CREATE FUNCTION pg_catalog.json_extract_path_text_op ( -json, text[] -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_extract_path_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object(text[], text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3401; -CREATE FUNCTION pg_catalog.json_object ( -text[], text[] -) RETURNS json LANGUAGE INTERNAL STABLE STRICT as 'json_object_two_arg'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object(text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3402; -CREATE FUNCTION pg_catalog.json_object ( -text[] -) RETURNS json LANGUAGE INTERNAL STABLE STRICT as 'json_object'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object_field(json, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3406; -CREATE FUNCTION pg_catalog.json_object_field ( -json, text -) RETURNS json LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_object_field'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object_field_text(json, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3948; -CREATE FUNCTION pg_catalog.json_object_field_text ( -json, text -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_object_field_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object_keys(json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3407; -CREATE FUNCTION pg_catalog.json_object_keys ( -json -) RETURNS SETOF text LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_object_keys'; - -DROP FUNCTION IF EXISTS pg_catalog.json_populate_record(anyelement, json, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3408; -CREATE FUNCTION pg_catalog.json_populate_record ( -anyelement, json, boolean DEFAULT false -) RETURNS anyelement LANGUAGE INTERNAL STABLE as 'json_populate_record'; - -DROP FUNCTION IF EXISTS pg_catalog.json_populate_recordset(anyelement, json, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3409; -CREATE FUNCTION pg_catalog.json_populate_recordset ( -anyelement, json, boolean DEFAULT false -) RETURNS SETOF anyelement LANGUAGE INTERNAL ROWS 100 STABLE as 'json_populate_recordset'; - -DROP FUNCTION IF EXISTS pg_catalog.json_to_record(json, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3410; -CREATE FUNCTION pg_catalog.json_to_record ( -json, boolean -) RETURNS record LANGUAGE INTERNAL STABLE as 'json_to_record'; - -DROP FUNCTION IF EXISTS pg_catalog.json_to_recordset(json, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3411; -CREATE FUNCTION pg_catalog.json_to_recordset ( -json, boolean -) RETURNS SETOF record LANGUAGE INTERNAL STABLE ROWS 100 as 'json_to_recordset'; - -DROP FUNCTION IF EXISTS pg_catalog.json_typeof(json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3270; -CREATE FUNCTION pg_catalog.json_typeof ( -json -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_typeof'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_element(jsonb, integer) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3412; -CREATE FUNCTION pg_catalog.jsonb_array_element ( -jsonb, integer -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_array_element'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_element_text(jsonb, integer) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3413; -CREATE FUNCTION pg_catalog.jsonb_array_element_text ( -jsonb, integer -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_array_element_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_elements(from_json jsonb, OUT value jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3414; -CREATE FUNCTION pg_catalog.jsonb_array_elements ( -from_json jsonb, OUT value jsonb -) RETURNS SETOF jsonb LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_array_elements'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_elements_text(from_json jsonb, OUT value text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3415; -CREATE FUNCTION pg_catalog.jsonb_array_elements_text ( -from_json jsonb, OUT value text -) RETURNS SETOF text LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_array_elements_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_length(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3416; -CREATE FUNCTION pg_catalog.jsonb_array_length ( -jsonb -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_array_length'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_cmp(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3417; -CREATE FUNCTION pg_catalog.jsonb_cmp ( -jsonb, jsonb -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_cmp'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_contained(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4050; -CREATE FUNCTION pg_catalog.jsonb_contained ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_contained'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_contains(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3418; -CREATE FUNCTION pg_catalog.jsonb_contains ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_contains'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_each(from_json jsonb, OUT key text, OUT value jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3419; -CREATE FUNCTION pg_catalog.jsonb_each ( -from_json jsonb, OUT key text, OUT value jsonb -) RETURNS SETOF record LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_each'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_each_text(from_json jsonb, OUT key text, OUT value text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3420; -CREATE FUNCTION pg_catalog.jsonb_each_text ( -from_json jsonb, OUT key text, OUT value text -) RETURNS SETOF record LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_each_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_eq(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3421; -CREATE FUNCTION pg_catalog.jsonb_eq ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_eq'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists(jsonb, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3422; -CREATE FUNCTION pg_catalog.jsonb_exists ( -jsonb, text -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_exists'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists_all(jsonb, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3423; -CREATE FUNCTION pg_catalog.jsonb_exists_all ( -jsonb, text[] -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_exists_all'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists_any(jsonb, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3424; -CREATE FUNCTION pg_catalog.jsonb_exists_any ( -jsonb, text[] -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_exists_any'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path(jsonb, VARIADIC text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3425; -CREATE FUNCTION pg_catalog.jsonb_extract_path ( -jsonb, VARIADIC text[] -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_extract_path'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_op(jsonb, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3319; -CREATE FUNCTION pg_catalog.jsonb_extract_path_op ( -jsonb, text[] -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_extract_path'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_text(jsonb, VARIADIC text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3426; -CREATE FUNCTION pg_catalog.jsonb_extract_path_text ( -jsonb, VARIADIC text[] -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_extract_path_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_text_op(jsonb, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3427; -CREATE FUNCTION pg_catalog.jsonb_extract_path_text_op ( -jsonb, text[] -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_extract_path_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_ge(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3428; -CREATE FUNCTION pg_catalog.jsonb_ge ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_ge'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_gt(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3429; -CREATE FUNCTION pg_catalog.jsonb_gt ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_gt'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_hash(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3430; -CREATE FUNCTION pg_catalog.jsonb_hash ( -jsonb -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_le(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3431; -CREATE FUNCTION pg_catalog.jsonb_le ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_le'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_lt(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4039; -CREATE FUNCTION pg_catalog.jsonb_lt ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_lt'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_ne(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3432; -CREATE FUNCTION pg_catalog.jsonb_ne ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_ne'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_field(jsonb, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3433; -CREATE FUNCTION pg_catalog.jsonb_object_field ( -jsonb, text -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_object_field'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_field_text(jsonb, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3434; -CREATE FUNCTION pg_catalog.jsonb_object_field_text ( -jsonb, text -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_object_field_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_keys(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3435; -CREATE FUNCTION pg_catalog.jsonb_object_keys ( -jsonb -) RETURNS SETOF text LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_object_keys'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_populate_record(anyelement, jsonb, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3437; -CREATE FUNCTION pg_catalog.jsonb_populate_record ( -anyelement, jsonb, boolean DEFAULT false -) RETURNS anyelement LANGUAGE INTERNAL STABLE as 'jsonb_populate_record'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_populate_recordset(anyelement, jsonb, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3438; -CREATE FUNCTION pg_catalog.jsonb_populate_recordset ( -anyelement, jsonb, boolean DEFAULT false -) RETURNS SETOF anyelement LANGUAGE INTERNAL STABLE ROWS 100 as 'jsonb_populate_recordset'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_typeof(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3445; -CREATE FUNCTION pg_catalog.jsonb_typeof ( -jsonb -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_typeof'; - -DROP FUNCTION IF EXISTS pg_catalog.to_json(anyelement) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3446; -CREATE FUNCTION pg_catalog.to_json ( -anyelement -) RETURNS json LANGUAGE INTERNAL STABLE STRICT as 'to_json'; - - --------------------------------------------------------------- --- add new operator --------------------------------------------------------------- -DROP OPERATOR IF EXISTS pg_catalog.->(json, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3962; -CREATE OPERATOR pg_catalog.->( -leftarg = json, rightarg = text, procedure = json_object_field -); -COMMENT ON OPERATOR pg_catalog.->(json, text) IS 'json_object_field'; - -DROP OPERATOR IF EXISTS pg_catalog.->>(json, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3963; -CREATE OPERATOR pg_catalog.->>( -leftarg = json, rightarg = text, procedure = json_object_field_text -); -COMMENT ON OPERATOR pg_catalog.->>(json, text) IS 'json_object_field_text'; - -DROP OPERATOR IF EXISTS pg_catalog.->(json, integer) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3964; -CREATE OPERATOR pg_catalog.->( -leftarg = json, rightarg = integer, procedure = json_array_element -); -COMMENT ON OPERATOR pg_catalog.->(json, integer) IS 'json_array_element'; - -DROP OPERATOR IF EXISTS pg_catalog.->>(json, integer) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3965; -CREATE OPERATOR pg_catalog.->>( -leftarg = json, rightarg = integer, procedure = json_array_element_text -); -COMMENT ON OPERATOR pg_catalog.->>(json, integer) IS 'json_array_element_text'; - -DROP OPERATOR IF EXISTS pg_catalog.#>(json, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3966; -CREATE OPERATOR pg_catalog.#>( -leftarg = json, rightarg = _text, procedure = json_extract_path_op -); -COMMENT ON OPERATOR pg_catalog.#>(json, _text) IS 'json_extract_path_op'; - -DROP OPERATOR IF EXISTS pg_catalog.#>>(json, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3967; -CREATE OPERATOR pg_catalog.#>>( -leftarg = json, rightarg = _text, procedure = json_extract_path_text_op -); -COMMENT ON OPERATOR pg_catalog.#>>(json, _text) IS 'json_extract_path_text_op'; - -DROP OPERATOR IF EXISTS pg_catalog.->(jsonb, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3211; -CREATE OPERATOR pg_catalog.->( -leftarg = jsonb, rightarg = text, procedure = jsonb_object_field -); -COMMENT ON OPERATOR pg_catalog.->(jsonb, text) IS 'jsonb_object_field'; - -DROP OPERATOR IF EXISTS pg_catalog.->>(jsonb, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3477; -CREATE OPERATOR pg_catalog.->>( -leftarg = jsonb, rightarg = text, procedure = jsonb_object_field_text -); -COMMENT ON OPERATOR pg_catalog.->>(jsonb, text) IS 'jsonb_object_field_text'; - -DROP OPERATOR IF EXISTS pg_catalog.->(jsonb, integer) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3212; -CREATE OPERATOR pg_catalog.->( -leftarg = jsonb, rightarg = integer, procedure = jsonb_array_element -); -COMMENT ON OPERATOR pg_catalog.->(jsonb, integer) IS 'jsonb_array_element'; - -DROP OPERATOR IF EXISTS pg_catalog.->>(jsonb, integer) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3481; -CREATE OPERATOR pg_catalog.->>( -leftarg = jsonb, rightarg = integer, procedure = jsonb_array_element_text -); -COMMENT ON OPERATOR pg_catalog.->>(jsonb, integer) IS 'jsonb_array_element_text'; - -DROP OPERATOR IF EXISTS pg_catalog.#>(jsonb, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3213; -CREATE OPERATOR pg_catalog.#>( -leftarg = jsonb, rightarg = _text, procedure = jsonb_extract_path_op -); -COMMENT ON OPERATOR pg_catalog.#>(jsonb, _text) IS 'jsonb_extract_path_op'; - -DROP OPERATOR IF EXISTS pg_catalog.#>>(jsonb, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3206; -CREATE OPERATOR pg_catalog.#>>( -leftarg = jsonb, rightarg = _text, procedure = jsonb_extract_path_text_op -); -COMMENT ON OPERATOR pg_catalog.#>>(jsonb, _text) IS 'jsonb_extract_path_text_op'; - -DROP OPERATOR IF EXISTS pg_catalog.=(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3240; -CREATE OPERATOR pg_catalog.=( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_eq, -commutator=operator(pg_catalog.=), -restrict = eqsel, join = eqjoinsel, -HASHES, MERGES -); -COMMENT ON OPERATOR pg_catalog.=(jsonb, jsonb) IS 'jsonb_eq'; - -DROP OPERATOR IF EXISTS pg_catalog.<>(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3241; -CREATE OPERATOR pg_catalog.<>( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_ne, -commutator=operator(pg_catalog.<>), negator=operator(pg_catalog.=), -restrict = neqsel, join = neqjoinsel -); -COMMENT ON OPERATOR pg_catalog.<>(jsonb, jsonb) IS 'jsonb_ne'; - -DROP OPERATOR IF EXISTS pg_catalog.<(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3242; -CREATE OPERATOR pg_catalog.<( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_lt, -restrict = scalarltsel, join = scalarltjoinsel -); -COMMENT ON OPERATOR pg_catalog.<(jsonb, jsonb) IS 'jsonb_lt'; - -DROP OPERATOR IF EXISTS pg_catalog.>(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3243; -CREATE OPERATOR pg_catalog.>( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_gt, -commutator=operator(pg_catalog.<), -restrict = scalargtsel, join = scalargtjoinsel -); -COMMENT ON OPERATOR pg_catalog.>(jsonb, jsonb) IS 'jsonb_gt'; - -DROP OPERATOR IF EXISTS pg_catalog.<=(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3244; -CREATE OPERATOR pg_catalog.<=( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_le, -negator=operator(pg_catalog.>), -restrict = scalarltsel, join = scalarltjoinsel -); -COMMENT ON OPERATOR pg_catalog.<=(jsonb, jsonb) IS 'jsonb_le'; - -DROP OPERATOR IF EXISTS pg_catalog.>=(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3245; -CREATE OPERATOR pg_catalog.>=( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_ge, -commutator=operator(pg_catalog.<=), negator=operator(pg_catalog.<), -restrict = scalargtsel, join = scalargtjoinsel -); -COMMENT ON OPERATOR pg_catalog.>=(jsonb, jsonb) IS 'jsonb_ge'; - -DROP OPERATOR IF EXISTS pg_catalog.@>(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3246; -CREATE OPERATOR pg_catalog.@>( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_contains, -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.@>(jsonb, jsonb) IS 'jsonb_contains'; - -DROP OPERATOR IF EXISTS pg_catalog.?(jsonb, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3247; -CREATE OPERATOR pg_catalog.?( -leftarg = jsonb, rightarg = text, procedure = jsonb_exists, -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.?(jsonb, text) IS 'jsonb_exists'; - -DROP OPERATOR IF EXISTS pg_catalog.?|(jsonb, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3248; -CREATE OPERATOR pg_catalog.?|( -leftarg = jsonb, rightarg = _text, procedure = jsonb_exists_any, -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.?|(jsonb, _text) IS 'jsonb_exists_any'; - -DROP OPERATOR IF EXISTS pg_catalog.?&(jsonb, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3249; -CREATE OPERATOR pg_catalog.?&( -leftarg = jsonb, rightarg = _text, procedure = jsonb_exists_all, -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.?&(jsonb, _text) IS 'jsonb_exists_all'; - -DROP OPERATOR IF EXISTS pg_catalog.<@(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3250; -CREATE OPERATOR pg_catalog.<@( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_contained, -negator=operator(pg_catalog.@>), -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.<@(jsonb, jsonb) IS 'jsonb_contained'; - - --------------------------------------------------------------- --- add pg_opfamily --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Insert_pg_opfamily_temp( -IN imethod integer, -IN iname text, -IN inamespace integer, -IN iowner integer -) -RETURNS void -AS $$ -DECLARE - row_name record; - query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - insert into pg_catalog.pg_opfamily values (imethod, iname, inamespace, iowner); - END LOOP; - return; -END; $$ -LANGUAGE 'plpgsql'; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4033; -select Insert_pg_opfamily_temp(403, 'jsonb_ops', 11, 10); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4034; -select Insert_pg_opfamily_temp(405, 'jsonb_ops', 11, 10); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4035; -select Insert_pg_opfamily_temp(783, 'jsonb_ops', 11, 10); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4036; -select Insert_pg_opfamily_temp(2742, 'jsonb_ops', 11, 10); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4037; -select Insert_pg_opfamily_temp(2742, 'jsonb_hash_ops', 11, 10); - -DROP FUNCTION Insert_pg_opfamily_temp(); - - --------------------------------------------------------------- --- add pg_cast --------------------------------------------------------------- -DROP CAST IF EXISTS (json AS jsonb) CASCADE; -CREATE CAST(json AS jsonb) WITH INOUT; - -DROP CAST IF EXISTS (jsonb AS json) CASCADE; -CREATE CAST(jsonb AS json) WITH INOUT; - - --------------------------------------------------------------- --- add pg_opclass --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Insert_pg_opclass_temp( -IN icmethod integer, -IN icname text, -IN icnamespace integer, -IN icowner integer, -IN icfamily integer, -IN icintype integer, -IN icdefault boolean, -IN ickeytype integer -) -RETURNS void -AS $$ -DECLARE - row_name record; - query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - insert into pg_catalog.pg_opclass values (icmethod, icname, icnamespace, icowner, icfamily, icintype, icdefault, ickeytype); - END LOOP; - return; -END; $$ -LANGUAGE 'plpgsql'; - -select Insert_pg_opclass_temp(403, 'jsonb_ops', 11, 10, 4033, 3802, true, 0); - -select Insert_pg_opclass_temp(405, 'jsonb_ops', 11, 10, 4034, 3802, true, 0); - -select Insert_pg_opclass_temp(2742, 'jsonb_ops', 11, 10, 4036, 3802, true, 25); - -select Insert_pg_opclass_temp(2742, 'jsonb_hash_ops', 11, 10, 4037, 3802, false, 23); - -DROP FUNCTION Insert_pg_opclass_temp(); - - - --------------------------------------------------------------- --- add pg_amproc --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Insert_pg_amproc_temp( -IN iprocfamily oid, -IN iproclefttype oid, -IN iprocrighttype oid, -IN iprocnum smallint, -IN iproc regproc -) -RETURNS void -AS $$ -DECLARE - row_name record; - query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - insert into pg_catalog.pg_amproc values (iprocfamily, iproclefttype, iprocrighttype, iprocnum, iproc); - END LOOP; - return; -END; $$ -LANGUAGE 'plpgsql'; - -SELECT Insert_pg_amproc_temp(4033, 3802, 3802, 1, 3417); - -SELECT Insert_pg_amproc_temp(4034, 3802, 3802, 1, 3430); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 1, 3498); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 2, 3482); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 3, 3493); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 4, 3497); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 6, 3494); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 1, 351); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 2, 3492); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 3, 3486); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 4, 3487); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 6, 3495); - -DROP FUNCTION Insert_pg_amproc_temp(); - - --------------------------------------------------------------- --- add pg_amop --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Insert_pg_amop_temp( -IN iopfamily integer, -IN ioplefttype integer, -IN ioprighttype integer, -IN iopstrategy integer, -IN ioppurpose character, -IN iopopr integer, -IN iopmethod integer, -IN iopsortfamily integer -) -RETURNS void -AS $$ -DECLARE - row_name record; - query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - insert into pg_catalog.pg_amop values (iopfamily, ioplefttype, ioprighttype, iopstrategy, ioppurpose, iopopr, iopmethod, iopsortfamily); - END LOOP; - return; -END; $$ -LANGUAGE 'plpgsql'; - -select Insert_pg_amop_temp(4033, 3802, 3802, 1, 's', 3242, 403, 0); - -select Insert_pg_amop_temp(4033, 3802, 3802, 2, 's', 3244, 403, 0); - -select Insert_pg_amop_temp(4033, 3802, 3802, 3, 's', 3240, 403, 0); - -select Insert_pg_amop_temp(4033, 3802, 3802, 4, 's', 3245, 403, 0); - -select Insert_pg_amop_temp(4033, 3802, 3802, 5, 's', 3243, 403, 0); - -select Insert_pg_amop_temp(4034, 3802, 3802, 1, 's', 3240, 405, 0); - -select Insert_pg_amop_temp(4036, 3802, 3802, 7, 's', 3246, 2742, 0); - -select Insert_pg_amop_temp(4036, 3802, 25, 9, 's', 3247, 2742, 0); - -select Insert_pg_amop_temp(4036, 3802, 1009, 10, 's', 3248, 2742, 0); - -select Insert_pg_amop_temp(4036, 3802, 1009, 11, 's', 3249, 2742, 0); - -select Insert_pg_amop_temp(4037, 3802, 3802, 7, 's', 3246, 2742, 0); - -drop function Insert_pg_amop_temp(); -SET search_path TO information_schema; - --- element_types is generated by data_type_privileges -DROP VIEW IF EXISTS information_schema.element_types CASCADE; - --- data_type_privileges is generated by columns -DROP VIEW IF EXISTS information_schema.data_type_privileges CASCADE; --- data_type_privileges is generated by table_privileges -DROP VIEW IF EXISTS information_schema.role_column_grants CASCADE; --- data_type_privileges is generated by column_privileges -DROP VIEW IF EXISTS information_schema.role_table_grants CASCADE; - --- other views need upgrade for matview -DROP VIEW IF EXISTS information_schema.column_domain_usage CASCADE; -DROP VIEW IF EXISTS information_schema.column_privileges CASCADE; -DROP VIEW IF EXISTS information_schema.column_udt_usage CASCADE; -DROP VIEW IF EXISTS information_schema.columns CASCADE; -DROP VIEW IF EXISTS information_schema.table_privileges CASCADE; -DROP VIEW IF EXISTS information_schema.tables CASCADE; -DROP VIEW IF EXISTS information_schema.view_column_usage CASCADE; -DROP VIEW IF EXISTS information_schema.view_table_usage CASCADE; - -CREATE VIEW information_schema.column_domain_usage AS - SELECT CAST(current_database() AS sql_identifier) AS domain_catalog, - CAST(nt.nspname AS sql_identifier) AS domain_schema, - CAST(t.typname AS sql_identifier) AS domain_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_type t, pg_namespace nt, pg_class c, pg_namespace nc, - pg_attribute a - - WHERE t.typnamespace = nt.oid - AND c.relnamespace = nc.oid - AND a.attrelid = c.oid - AND a.atttypid = t.oid - AND t.typtype = 'd' - AND c.relkind IN ('r', 'm', 'v', 'f') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND a.attnum > 0 - AND NOT a.attisdropped - AND pg_has_role(t.typowner, 'USAGE'); - -CREATE VIEW information_schema.column_privileges AS - SELECT CAST(u_grantor.rolname AS sql_identifier) AS grantor, - CAST(grantee.rolname AS sql_identifier) AS grantee, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(x.relname AS sql_identifier) AS table_name, - CAST(x.attname AS sql_identifier) AS column_name, - CAST(x.prtype AS character_data) AS privilege_type, - CAST( - CASE WHEN - -- object owner always has grant options - pg_has_role(x.grantee, x.relowner, 'USAGE') - OR x.grantable - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable - - FROM ( - SELECT pr_c.grantor, - pr_c.grantee, - attname, - relname, - relnamespace, - pr_c.prtype, - pr_c.grantable, - pr_c.relowner - FROM (SELECT oid, relname, relnamespace, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).* - FROM pg_class - WHERE relkind IN ('r', 'm', 'v', 'f') - ) pr_c (oid, relname, relnamespace, relowner, grantor, grantee, prtype, grantable), - pg_attribute a - WHERE a.attrelid = pr_c.oid - AND a.attnum > 0 - AND NOT a.attisdropped - UNION - SELECT pr_a.grantor, - pr_a.grantee, - attname, - relname, - relnamespace, - pr_a.prtype, - pr_a.grantable, - c.relowner - FROM (SELECT attrelid, attname, (aclexplode(coalesce(attacl, acldefault('c', relowner)))).* - FROM pg_attribute a JOIN pg_class cc ON (a.attrelid = cc.oid) - WHERE attnum > 0 - AND NOT attisdropped - ) pr_a (attrelid, attname, grantor, grantee, prtype, grantable), - pg_class c - WHERE pr_a.attrelid = c.oid - AND relkind IN ('r', 'm', 'v', 'f') - ) x, - pg_namespace nc, - pg_authid u_grantor, - ( - SELECT oid, rolname FROM pg_authid - UNION ALL - SELECT 0::oid, 'PUBLIC' - ) AS grantee (oid, rolname) - - WHERE x.relnamespace = nc.oid - AND x.grantee = grantee.oid - AND x.grantor = u_grantor.oid - AND x.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'REFERENCES', 'COMMENT') - AND (x.relname not like 'mlog_%' AND x.relname not like 'matviewmap_%') - AND (pg_has_role(u_grantor.oid, 'USAGE') - OR pg_has_role(grantee.oid, 'USAGE') - OR grantee.rolname = 'PUBLIC'); - -CREATE VIEW information_schema.column_udt_usage AS - SELECT CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(coalesce(nbt.nspname, nt.nspname) AS sql_identifier) AS udt_schema, - CAST(coalesce(bt.typname, t.typname) AS sql_identifier) AS udt_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_attribute a, pg_class c, pg_namespace nc, - (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) - ON (t.typtype = 'd' AND t.typbasetype = bt.oid) - - WHERE a.attrelid = c.oid - AND a.atttypid = t.oid - AND nc.oid = c.relnamespace - AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'm', 'v', 'f') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND pg_has_role(coalesce(bt.typowner, t.typowner), 'USAGE'); - -CREATE VIEW information_schema.columns AS - SELECT CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name, - CAST(a.attnum AS cardinal_number) AS ordinal_position, - CAST(CASE WHEN ad.adgencol <> 's' THEN pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS column_default, - CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END - AS yes_or_no) - AS is_nullable, - - CAST( - CASE WHEN t.typtype = 'd' THEN - CASE WHEN bt.typelem <> 0 AND bt.typlen = -1 THEN 'ARRAY' - WHEN nbt.nspname = 'pg_catalog' THEN format_type(t.typbasetype, null) - ELSE 'USER-DEFINED' END - ELSE - CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY' - WHEN nt.nspname = 'pg_catalog' THEN format_type(a.atttypid, null) - ELSE 'USER-DEFINED' END - END - AS character_data) - AS data_type, - - CAST( - _pg_char_max_length(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS character_maximum_length, - - CAST( - _pg_char_octet_length(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS character_octet_length, - - CAST( - _pg_numeric_precision(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_precision, - - CAST( - _pg_numeric_precision_radix(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_precision_radix, - - CAST( - _pg_numeric_scale(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_scale, - - CAST( - _pg_datetime_precision(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS datetime_precision, - - CAST( - _pg_interval_type(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS character_data) - AS interval_type, - CAST(null AS cardinal_number) AS interval_precision, - - CAST(null AS sql_identifier) AS character_set_catalog, - CAST(null AS sql_identifier) AS character_set_schema, - CAST(null AS sql_identifier) AS character_set_name, - - CAST(CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS sql_identifier) AS collation_catalog, - CAST(nco.nspname AS sql_identifier) AS collation_schema, - CAST(co.collname AS sql_identifier) AS collation_name, - - CAST(CASE WHEN t.typtype = 'd' THEN current_database() ELSE null END - AS sql_identifier) AS domain_catalog, - CAST(CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE null END - AS sql_identifier) AS domain_schema, - CAST(CASE WHEN t.typtype = 'd' THEN t.typname ELSE null END - AS sql_identifier) AS domain_name, - - CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(coalesce(nbt.nspname, nt.nspname) AS sql_identifier) AS udt_schema, - CAST(coalesce(bt.typname, t.typname) AS sql_identifier) AS udt_name, - - CAST(null AS sql_identifier) AS scope_catalog, - CAST(null AS sql_identifier) AS scope_schema, - CAST(null AS sql_identifier) AS scope_name, - - CAST(null AS cardinal_number) AS maximum_cardinality, - CAST(a.attnum AS sql_identifier) AS dtd_identifier, - CAST('NO' AS yes_or_no) AS is_self_referencing, - - CAST('NO' AS yes_or_no) AS is_identity, - CAST(null AS character_data) AS identity_generation, - CAST(null AS character_data) AS identity_start, - CAST(null AS character_data) AS identity_increment, - CAST(null AS character_data) AS identity_maximum, - CAST(null AS character_data) AS identity_minimum, - CAST(null AS yes_or_no) AS identity_cycle, - - CAST(CASE WHEN ad.adgencol = 's' THEN 'ALWAYS' ELSE 'NEVER' END AS character_data) AS is_generated, - CAST(CASE WHEN ad.adgencol = 's' THEN pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS generation_expression, - - CAST(CASE WHEN c.relkind = 'r' - OR (c.relkind = 'v' - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead) - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_updatable - - FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum) - JOIN (pg_class c JOIN pg_namespace nc ON (c.relnamespace = nc.oid)) ON a.attrelid = c.oid - JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON a.atttypid = t.oid - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) - ON (t.typtype = 'd' AND t.typbasetype = bt.oid) - LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid)) - ON a.attcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default') - - WHERE (NOT pg_is_other_temp_schema(nc.oid)) - - AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'm', 'v', 'f') - - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - - AND (pg_has_role(c.relowner, 'USAGE') - OR has_column_privilege(c.oid, a.attnum, - 'SELECT, INSERT, UPDATE, REFERENCES')); - -CREATE VIEW information_schema.table_privileges AS - SELECT CAST(u_grantor.rolname AS sql_identifier) AS grantor, - CAST(grantee.rolname AS sql_identifier) AS grantee, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(c.prtype AS character_data) AS privilege_type, - CAST( - CASE WHEN - -- object owner always has grant options - pg_has_role(grantee.oid, c.relowner, 'USAGE') - OR c.grantable - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable, - CAST(CASE WHEN c.prtype = 'SELECT' THEN 'YES' ELSE 'NO' END AS yes_or_no) AS with_hierarchy - - FROM ( - SELECT oid, relname, relnamespace, relkind, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).* FROM pg_class - ) AS c (oid, relname, relnamespace, relkind, relowner, grantor, grantee, prtype, grantable), - pg_namespace nc, - pg_authid u_grantor, - ( - SELECT oid, rolname FROM pg_authid - UNION ALL - SELECT 0::oid, 'PUBLIC' - ) AS grantee (oid, rolname) - - WHERE c.relnamespace = nc.oid - AND c.relkind IN ('r', 'm', 'v') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND c.grantee = grantee.oid - AND c.grantor = u_grantor.oid - AND (c.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER') - OR c.prtype IN ('ALTER', 'DROP', 'COMMENT', 'INDEX', 'VACUUM') - ) - AND (pg_has_role(u_grantor.oid, 'USAGE') - OR pg_has_role(grantee.oid, 'USAGE') - OR grantee.rolname = 'PUBLIC'); - -CREATE VIEW information_schema.tables AS - SELECT CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - - CAST( - CASE WHEN nc.oid = pg_my_temp_schema() THEN 'LOCAL TEMPORARY' - WHEN c.relkind = 'r' THEN 'BASE TABLE' - WHEN c.relkind = 'm' THEN 'MATERIALIZED VIEW' - WHEN c.relkind = 'v' THEN 'VIEW' - WHEN c.relkind = 'f' THEN 'FOREIGN TABLE' - ELSE null END - AS character_data) AS table_type, - - CAST(null AS sql_identifier) AS self_referencing_column_name, - CAST(null AS character_data) AS reference_generation, - - CAST(CASE WHEN t.typname IS NOT NULL THEN current_database() ELSE null END AS sql_identifier) AS user_defined_type_catalog, - CAST(nt.nspname AS sql_identifier) AS user_defined_type_schema, - CAST(t.typname AS sql_identifier) AS user_defined_type_name, - - CAST(CASE WHEN c.relkind = 'r' - OR (c.relkind = 'v' - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_insertable_into, - - CAST(CASE WHEN t.typname IS NOT NULL THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_typed, - CAST(null AS character_data) AS commit_action - - FROM pg_namespace nc JOIN pg_class c ON (nc.oid = c.relnamespace) - LEFT JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON (c.reloftype = t.oid) - - WHERE c.relkind IN ('r', 'm', 'v', 'f') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND (NOT pg_is_other_temp_schema(nc.oid)) - AND (pg_has_role(c.relowner, 'USAGE') - OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') - OR has_any_column_privilege(c.oid, 'SELECT, INSERT, UPDATE, REFERENCES') ); - -CREATE VIEW information_schema.view_column_usage AS - SELECT DISTINCT - CAST(current_database() AS sql_identifier) AS view_catalog, - CAST(nv.nspname AS sql_identifier) AS view_schema, - CAST(v.relname AS sql_identifier) AS view_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nt.nspname AS sql_identifier) AS table_schema, - CAST(t.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_namespace nv, pg_class v, pg_depend dv, - pg_depend dt, pg_class t, pg_namespace nt, - pg_attribute a - - WHERE nv.oid = v.relnamespace - AND v.relkind = 'v' - AND v.oid = dv.refobjid - AND dv.refclassid = 'pg_catalog.pg_class'::regclass - AND dv.classid = 'pg_catalog.pg_rewrite'::regclass - AND dv.deptype = 'i' - AND dv.objid = dt.objid - AND dv.refobjid <> dt.refobjid - AND dt.classid = 'pg_catalog.pg_rewrite'::regclass - AND dt.refclassid = 'pg_catalog.pg_class'::regclass - AND dt.refobjid = t.oid - AND t.relnamespace = nt.oid - AND t.relkind IN ('r', 'm', 'v', 'f') - AND (t.relname not like 'mlog_%' AND t.relname not like 'matviewmap_%') - AND t.oid = a.attrelid - AND dt.refobjsubid = a.attnum - AND pg_has_role(t.relowner, 'USAGE'); - -CREATE VIEW information_schema.view_table_usage AS - SELECT DISTINCT - CAST(current_database() AS sql_identifier) AS view_catalog, - CAST(nv.nspname AS sql_identifier) AS view_schema, - CAST(v.relname AS sql_identifier) AS view_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nt.nspname AS sql_identifier) AS table_schema, - CAST(t.relname AS sql_identifier) AS table_name - - FROM pg_namespace nv, pg_class v, pg_depend dv, - pg_depend dt, pg_class t, pg_namespace nt - - WHERE nv.oid = v.relnamespace - AND v.relkind = 'v' - AND v.oid = dv.refobjid - AND dv.refclassid = 'pg_catalog.pg_class'::regclass - AND dv.classid = 'pg_catalog.pg_rewrite'::regclass - AND dv.deptype = 'i' - AND dv.objid = dt.objid - AND dv.refobjid <> dt.refobjid - AND dt.classid = 'pg_catalog.pg_rewrite'::regclass - AND dt.refclassid = 'pg_catalog.pg_class'::regclass - AND dt.refobjid = t.oid - AND t.relnamespace = nt.oid - AND t.relkind IN ('r', 'm', 'v', 'f') - AND (t.relname not like 'mlog_%' AND t.relname not like 'matviewmap_%') - AND pg_has_role(t.relowner, 'USAGE'); - -CREATE VIEW information_schema.data_type_privileges AS - SELECT CAST(current_database() AS sql_identifier) AS object_catalog, - CAST(x.objschema AS sql_identifier) AS object_schema, - CAST(x.objname AS sql_identifier) AS object_name, - CAST(x.objtype AS character_data) AS object_type, - CAST(x.objdtdid AS sql_identifier) AS dtd_identifier - - FROM - ( - SELECT udt_schema, udt_name, 'USER-DEFINED TYPE'::text, dtd_identifier FROM attributes - UNION ALL - SELECT table_schema, table_name, 'TABLE'::text, dtd_identifier FROM columns - UNION ALL - SELECT domain_schema, domain_name, 'DOMAIN'::text, dtd_identifier FROM domains - UNION ALL - SELECT specific_schema, specific_name, 'ROUTINE'::text, dtd_identifier FROM parameters - UNION ALL - SELECT specific_schema, specific_name, 'ROUTINE'::text, dtd_identifier FROM routines - ) AS x (objschema, objname, objtype, objdtdid); - -CREATE VIEW information_schema.role_column_grants AS - SELECT grantor, - grantee, - table_catalog, - table_schema, - table_name, - column_name, - privilege_type, - is_grantable - FROM column_privileges - WHERE grantor IN (SELECT role_name FROM enabled_roles) - OR grantee IN (SELECT role_name FROM enabled_roles); - -CREATE VIEW information_schema.role_table_grants AS - SELECT grantor, - grantee, - table_catalog, - table_schema, - table_name, - privilege_type, - is_grantable, - with_hierarchy - FROM table_privileges - WHERE grantor IN (SELECT role_name FROM enabled_roles) - OR grantee IN (SELECT role_name FROM enabled_roles); - -CREATE VIEW information_schema.element_types AS - SELECT CAST(current_database() AS sql_identifier) AS object_catalog, - CAST(n.nspname AS sql_identifier) AS object_schema, - CAST(x.objname AS sql_identifier) AS object_name, - CAST(x.objtype AS character_data) AS object_type, - CAST(x.objdtdid AS sql_identifier) AS collection_type_identifier, - CAST( - CASE WHEN nbt.nspname = 'pg_catalog' THEN format_type(bt.oid, null) - ELSE 'USER-DEFINED' END AS character_data) AS data_type, - - CAST(null AS cardinal_number) AS character_maximum_length, - CAST(null AS cardinal_number) AS character_octet_length, - CAST(null AS sql_identifier) AS character_set_catalog, - CAST(null AS sql_identifier) AS character_set_schema, - CAST(null AS sql_identifier) AS character_set_name, - CAST(CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS sql_identifier) AS collation_catalog, - CAST(nco.nspname AS sql_identifier) AS collation_schema, - CAST(co.collname AS sql_identifier) AS collation_name, - CAST(null AS cardinal_number) AS numeric_precision, - CAST(null AS cardinal_number) AS numeric_precision_radix, - CAST(null AS cardinal_number) AS numeric_scale, - CAST(null AS cardinal_number) AS datetime_precision, - CAST(null AS character_data) AS interval_type, - CAST(null AS cardinal_number) AS interval_precision, - - CAST(null AS character_data) AS domain_default, -- XXX maybe a bug in the standard - - CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(nbt.nspname AS sql_identifier) AS udt_schema, - CAST(bt.typname AS sql_identifier) AS udt_name, - - CAST(null AS sql_identifier) AS scope_catalog, - CAST(null AS sql_identifier) AS scope_schema, - CAST(null AS sql_identifier) AS scope_name, - - CAST(null AS cardinal_number) AS maximum_cardinality, - CAST('a' || CAST(x.objdtdid AS text) AS sql_identifier) AS dtd_identifier - - FROM pg_namespace n, pg_type at, pg_namespace nbt, pg_type bt, - ( - /* columns, attributes */ - SELECT c.relnamespace, CAST(c.relname AS sql_identifier), - CASE WHEN c.relkind = 'c' THEN 'USER-DEFINED TYPE'::text ELSE 'TABLE'::text END, - a.attnum, a.atttypid, a.attcollation - FROM pg_class c, pg_attribute a - WHERE c.oid = a.attrelid - AND c.relkind IN ('r', 'm', 'v', 'f', 'c') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND attnum > 0 AND NOT attisdropped - - UNION ALL - - /* domains */ - SELECT t.typnamespace, CAST(t.typname AS sql_identifier), - 'DOMAIN'::text, 1, t.typbasetype, t.typcollation - FROM pg_type t - WHERE t.typtype = 'd' - - UNION ALL - - /* parameters */ - SELECT pronamespace, CAST(proname || '_' || CAST(oid AS text) AS sql_identifier), - 'ROUTINE'::text, (ss.x).n, (ss.x).x, 0 - FROM (SELECT p.pronamespace, p.proname, p.oid, - _pg_expandarray(coalesce(p.proallargtypes, p.proargtypes::oid[])) AS x - FROM pg_proc p) AS ss - - UNION ALL - - /* result types */ - SELECT p.pronamespace, CAST(p.proname || '_' || CAST(p.oid AS text) AS sql_identifier), - 'ROUTINE'::text, 0, p.prorettype, 0 - FROM pg_proc p - - ) AS x (objschema, objname, objtype, objdtdid, objtypeid, objcollation) - LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid)) - ON x.objcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default') - - WHERE n.oid = x.objschema - AND at.oid = x.objtypeid - AND (at.typelem <> 0 AND at.typlen = -1) - AND at.typelem = bt.oid - AND nbt.oid = bt.typnamespace - - AND (n.nspname, x.objname, x.objtype, CAST(x.objdtdid AS sql_identifier)) IN - ( SELECT object_schema, object_name, object_type, dtd_identifier - FROM data_type_privileges ); - -GRANT SELECT ON information_schema.element_types TO PUBLIC; -GRANT SELECT ON information_schema.data_type_privileges TO PUBLIC; -GRANT SELECT ON information_schema.role_column_grants TO PUBLIC; -GRANT SELECT ON information_schema.role_table_grants TO PUBLIC; -GRANT SELECT ON information_schema.column_domain_usage TO PUBLIC; -GRANT SELECT ON information_schema.column_privileges TO PUBLIC; -GRANT SELECT ON information_schema.column_udt_usage TO PUBLIC; -GRANT SELECT ON information_schema.columns TO PUBLIC; -GRANT SELECT ON information_schema.table_privileges TO PUBLIC; -GRANT SELECT ON information_schema.tables TO PUBLIC; -GRANT SELECT ON information_schema.view_column_usage TO PUBLIC; -GRANT SELECT ON information_schema.view_table_usage TO PUBLIC; - -RESET search_path; - -DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6322; -CREATE FUNCTION pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text, OUT decrypt_result_str text) RETURNS text LANGUAGE INTERNAL as 'gs_decrypt'; - -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6323; -CREATE FUNCTION pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text, OUT encrypt_result_str text) RETURNS text LANGUAGE INTERNAL as 'gs_encrypt'; -DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6322; -CREATE FUNCTION pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text, OUT decrypt_result_str text) RETURNS text LANGUAGE INTERNAL as 'gs_decrypt'; - -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6323; -CREATE FUNCTION pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text, OUT encrypt_result_str text) RETURNS text LANGUAGE INTERNAL as 'gs_encrypt';UPDATE pg_catalog.pg_am set amcanunique = TRUE where amname = 'cbtree'; -CREATE OR REPLACE VIEW pg_catalog.gs_session_cpu_statistics AS -SELECT - S.datid AS datid, - S.usename, - S.pid, - S.query_start AS start_time, - T.min_cpu_time, - T.max_cpu_time, - T.total_cpu_time, - S.query, - S.node_group, - T.top_cpu_dn -FROM pg_stat_activity_ng AS S, pg_stat_get_wlm_realtime_session_info(NULL) AS T -WHERE S.sessionid = T.threadid; diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_425.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_425.sql deleted file mode 100644 index 8df9ec035..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade-post_catalog_maindb_92_425.sql +++ /dev/null @@ -1,148 +0,0 @@ --- adding system table pg_subscription - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, true, 6126, 6128, 0, 0; - -CREATE TABLE IF NOT EXISTS pg_catalog.pg_subscription -( - subdbid oid NOCOMPRESS NOT NULL, - subname name NOCOMPRESS, - subowner oid NOCOMPRESS, - subenabled bool NOCOMPRESS, - subconninfo text NOCOMPRESS, - subslotname name NOCOMPRESS, - subsynccommit bool NOCOMPRESS, - subpublications text[] NOCOMPRESS -) WITH OIDS TABLESPACE pg_global; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, true, 0, 0, 0, 6124; -CREATE UNIQUE INDEX pg_subscription_oid_index ON pg_catalog.pg_subscription USING BTREE(oid OID_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, true, 0, 0, 0, 6125; -CREATE UNIQUE INDEX pg_subscription_subname_index ON pg_catalog.pg_subscription USING BTREE(subdbid, subname); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0; - -GRANT SELECT ON TABLE pg_catalog.pg_subscription TO PUBLIC; - --- adding system table pg_replication_origin - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, true, 6134, 6143, 0, 0; - -CREATE TABLE IF NOT EXISTS pg_catalog.pg_replication_origin -( - roident oid NOCOMPRESS NOT NULL, - roname text NOCOMPRESS -) TABLESPACE pg_global; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, true, 0, 0, 0, 6136; -CREATE UNIQUE INDEX pg_replication_origin_roident_index ON pg_catalog.pg_replication_origin USING BTREE(roident OID_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, true, 0, 0, 0, 6137; -CREATE UNIQUE INDEX pg_replication_origin_roname_index ON pg_catalog.pg_replication_origin USING BTREE(roname TEXT_PATTERN_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0; - -GRANT SELECT ON TABLE pg_catalog.pg_replication_origin TO PUBLIC; - --- adding function pg_replication_origin_create -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_create(IN node_name text, OUT replication_origin_oid oid) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2635; -CREATE FUNCTION pg_catalog.pg_replication_origin_create(IN node_name text, OUT replication_origin_oid oid) RETURNS oid LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_create'; - --- adding function pg_replication_origin_drop -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_drop(IN node_name text, OUT replication_origin_oid oid) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2636; -CREATE FUNCTION pg_catalog.pg_replication_origin_drop(IN node_name text, OUT replication_origin_oid oid) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_drop'; - --- adding function pg_replication_origin_oid -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_oid(IN node_name text, OUT replication_origin_oid oid) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2637; -CREATE FUNCTION pg_catalog.pg_replication_origin_oid(IN node_name text, OUT replication_origin_oid oid) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_oid'; - --- adding function pg_replication_origin_session_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_setup(IN node_name text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2751; -CREATE FUNCTION pg_catalog.pg_replication_origin_session_setup(IN node_name text) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_session_setup'; - --- adding function pg_replication_origin_session_reset -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_reset() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2750; -CREATE FUNCTION pg_catalog.pg_replication_origin_session_reset() RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_session_reset'; - --- adding function pg_replication_origin_session_is_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_is_setup() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2639; -CREATE FUNCTION pg_catalog.pg_replication_origin_session_is_setup() RETURNS boolean LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_session_is_setup'; - --- adding function pg_replication_origin_session_progress -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_progress(IN flush boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2640; -CREATE FUNCTION pg_catalog.pg_replication_origin_session_progress(IN flush boolean) RETURNS record LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_session_progress'; - --- adding function pg_replication_origin_xact_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_xact_setup(IN origin_lsn text, IN origin_timestamp timestamp with time zone) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2799; -CREATE FUNCTION pg_catalog.pg_replication_origin_xact_setup(IN origin_lsn text, IN origin_timestamp timestamp with time zone) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_xact_setup'; - --- adding function pg_replication_origin_xact_reset -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_xact_reset() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2752; -CREATE FUNCTION pg_catalog.pg_replication_origin_xact_reset() RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_xact_reset'; - --- adding function pg_replication_origin_advance -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_advance(IN node_name text, IN lsn text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2634; -CREATE FUNCTION pg_catalog.pg_replication_origin_advance(IN node_name text, IN lsn text) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_advance'; - --- adding function pg_replication_origin_progress -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_progress(IN node_name text, IN flush boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2638; -CREATE FUNCTION pg_catalog.pg_replication_origin_progress(IN node_name text, IN flush boolean) RETURNS record LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_progress'; - --- adding function pg_show_replication_origin_status -DROP FUNCTION IF EXISTS pg_catalog.pg_show_replication_origin_status(OUT local_id oid, OUT external_id text, OUT remote_lsn text, OUT local_lsn text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2800; -CREATE FUNCTION pg_catalog.pg_show_replication_origin_status(OUT local_id oid, OUT external_id text, OUT remote_lsn text, OUT local_lsn text) RETURNS SETOF record LANGUAGE INTERNAL STABLE ROWS 100 AS 'pg_show_replication_origin_status'; - --- adding function pg_get_publication_tables -DROP FUNCTION IF EXISTS pg_catalog.pg_get_publication_tables(IN pubname text, OUT relid oid) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2801; -CREATE FUNCTION pg_catalog.pg_get_publication_tables(IN pubname text, OUT relid oid) RETURNS SETOF oid LANGUAGE INTERNAL STABLE STRICT AS 'pg_get_publication_tables'; - --- adding function pg_stat_get_subscription -DROP FUNCTION IF EXISTS pg_catalog.pg_stat_get_subscription(IN subid oid, OUT subid oid, OUT pid integer, OUT received_lsn text, OUT last_msg_send_time timestamp with time zone, OUT last_msg_receipt_time timestamp with time zone, OUT latest_end_lsn text, OUT latest_end_time timestamp with time zone) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2802; -CREATE FUNCTION pg_catalog.pg_stat_get_subscription(IN subid oid, OUT subid oid, OUT pid integer, OUT received_lsn text, OUT last_msg_send_time timestamp with time zone, OUT last_msg_receipt_time timestamp with time zone, OUT latest_end_lsn text, OUT latest_end_time timestamp with time zone) RETURNS record LANGUAGE INTERNAL STABLE AS 'pg_stat_get_subscription'; - --- adding system view -DROP VIEW IF EXISTS pg_catalog.pg_publication_tables CASCADE; -CREATE VIEW pg_catalog.pg_publication_tables AS - SELECT - P.pubname AS pubname, - N.nspname AS schemaname, - C.relname AS tablename - FROM pg_publication P, pg_class C - JOIN pg_namespace N ON (N.oid = C.relnamespace) - WHERE C.oid IN (SELECT relid FROM pg_get_publication_tables(P.pubname)); - -DROP VIEW IF EXISTS pg_catalog.pg_stat_subscription CASCADE; -CREATE VIEW pg_catalog.pg_stat_subscription AS - SELECT - su.oid AS subid, - su.subname, - st.pid, - st.received_lsn, - st.last_msg_send_time, - st.last_msg_receipt_time, - st.latest_end_lsn, - st.latest_end_time - FROM pg_subscription su - LEFT JOIN pg_stat_get_subscription(NULL) st - ON (st.subid = su.oid); - -DROP VIEW IF EXISTS pg_catalog.pg_replication_origin_status CASCADE; -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 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 5b47ecbbd..6d7b148cf 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 @@ -4561,7 +4561,7 @@ CREATE TABLE IF NOT EXISTS pg_catalog.pg_subscription subenabled bool NOCOMPRESS, subconninfo text NOCOMPRESS, subslotname name NOCOMPRESS, - subsynccommit bool NOCOMPRESS, + subsynccommit text NOCOMPRESS, subpublications text[] NOCOMPRESS ) WITH OIDS TABLESPACE pg_global; diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_420.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_420.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_421.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_421.sql deleted file mode 100644 index ee6088557..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_421.sql +++ /dev/null @@ -1,4 +0,0 @@ --- -------------------------------------------------------------- --- upgrade pg_catalog.pg_collation --- -------------------------------------------------------------- -insert into pg_catalog.pg_collation values ('zh_CN', 11, 10, 36, 'zh_CN.gb18030', 'zh_CN.gb18030'), ('zh_CN.gb18030', 11, 10, 36, 'zh_CN.gb18030', 'zh_CN.gb18030'); \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_422.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_422.sql deleted file mode 100644 index 5285b72f6..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_422.sql +++ /dev/null @@ -1,20 +0,0 @@ --- -------------------------------------------------------------- --- upgrade pg_catalog.pg_buffercache_pages --- -------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.pg_buffercache_pages() CASCADE; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4130; -CREATE OR REPLACE FUNCTION pg_catalog.pg_buffercache_pages -(out bufferid pg_catalog.int4, -out relfilenode pg_catalog.oid, -out bucketid pg_catalog.int4, -out storage_type pg_catalog.int2, -out reltablespace pg_catalog.oid, -out reldatabase pg_catalog.oid, -out relforknumber pg_catalog.int2, -out relblocknumber pg_catalog.int8, -out isdirty pg_catalog.bool, -out isvalid pg_catalog.bool, -out usage_count pg_catalog.int2, -out pinning_backends pg_catalog.int4) -RETURNS SETOF record LANGUAGE INTERNAL STABLE STRICT as 'pg_buffercache_pages'; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_424.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_424.sql deleted file mode 100644 index 2ecbe12fe..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_424.sql +++ /dev/null @@ -1,22 +0,0 @@ -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4768; -CREATE OR REPLACE FUNCTION pg_catalog.gs_read_block_from_remote -( int4, - int4, - int4, - int2, - int2, - int4, - xid, - int4, - xid, - boolean) -RETURNS SETOF record LANGUAGE INTERNAL ROWS 1 STRICT as 'gs_read_block_from_remote_compress'; --- pg_read_binary_file_blocks() --- -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 8413; -CREATE FUNCTION pg_catalog.pg_read_binary_file_blocks(IN inputpath text, IN startblocknum int8, IN count int8, - OUT path text, - OUT blocknum int4, - OUT len int4, - OUT data bytea) - AS 'pg_read_binary_file_blocks' LANGUAGE INTERNAL IMMUTABLE STRICT; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_425.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_425.sql deleted file mode 100644 index e3ae049cd..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_maindb/upgrade_catalog_maindb_92_425.sql +++ /dev/null @@ -1,43 +0,0 @@ --- adding system table pg_publication - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 6130, 6141, 0, 0; - -CREATE TABLE IF NOT EXISTS pg_catalog.pg_publication -( - pubname name NOCOMPRESS, - pubowner oid NOCOMPRESS, - puballtables bool NOCOMPRESS, - pubinsert bool NOCOMPRESS, - pubupdate bool NOCOMPRESS, - pubdelete bool NOCOMPRESS -) WITH OIDS; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 6120; -CREATE UNIQUE INDEX pg_publication_oid_index ON pg_catalog.pg_publication USING BTREE(oid OID_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 6121; -CREATE UNIQUE INDEX pg_publication_pubname_index ON pg_catalog.pg_publication USING BTREE(pubname); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0; - -GRANT SELECT ON TABLE pg_catalog.pg_publication TO PUBLIC; - --- adding system table pg_publication_rel - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 6132, 6142, 0, 0; - -CREATE TABLE IF NOT EXISTS pg_catalog.pg_publication_rel -( - prpubid oid NOCOMPRESS NOT NULL, - prrelid oid NOCOMPRESS NOT NULL -) WITH OIDS; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 6122; -CREATE UNIQUE INDEX pg_publication_rel_oid_index ON pg_catalog.pg_publication_rel USING BTREE(oid OID_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 6123; -CREATE UNIQUE INDEX pg_publication_rel_map_index ON pg_catalog.pg_publication_rel USING BTREE(prrelid, prpubid); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0; - -GRANT SELECT ON TABLE pg_catalog.pg_publication_rel TO PUBLIC; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_420.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_420.sql deleted file mode 100644 index 362938e5a..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_420.sql +++ /dev/null @@ -1,1418 +0,0 @@ --------------------------------------------------------------- --- add new type jsonb --------------------------------------------------------------- -DROP TYPE IF EXISTS pg_catalog.jsonb; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_TYPE, 3802, 0, b; -CREATE TYPE pg_catalog.jsonb; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_in(cstring) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3806; -CREATE FUNCTION pg_catalog.jsonb_in ( -cstring -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_in'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_out(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3436; -CREATE FUNCTION pg_catalog.jsonb_out ( -jsonb -) RETURNS cstring LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_out'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_send(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3444; -CREATE FUNCTION pg_catalog.jsonb_send ( -jsonb -) RETURNS bytea LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_send'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_recv(internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3443; -CREATE FUNCTION pg_catalog.jsonb_recv ( -internal -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_recv'; - -CREATE TYPE pg_catalog.jsonb (input=jsonb_in, output=jsonb_out, RECEIVE = jsonb_recv, SEND = jsonb_send, STORAGE=EXTENDED, category='C'); -COMMENT ON TYPE pg_catalog.jsonb IS 'json binary'; -COMMENT ON TYPE pg_catalog._jsonb IS 'json binary'; - - ----------------------------------------------------------------- --- add two agg funcs ----------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.json_agg_finalfn(internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3125; -CREATE FUNCTION pg_catalog.json_agg_finalfn ( -internal -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_agg_finalfn'; - -DROP FUNCTION IF EXISTS pg_catalog.json_agg_transfn(internal, anyelement) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3126; -CREATE FUNCTION pg_catalog.json_agg_transfn ( -internal, anyelement -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE as 'json_agg_transfn'; - -drop aggregate if exists pg_catalog.json_agg(anyelement); -SET LOCAL inplace_upgrade_next_system_object_oids=IUO_PROC, 3124; -create aggregate pg_catalog.json_agg(anyelement) (SFUNC=json_agg_transfn, STYPE= internal, finalfunc = json_agg_finalfn); - - -DROP FUNCTION IF EXISTS pg_catalog.json_object_agg_finalfn(internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3404; -CREATE FUNCTION pg_catalog.json_object_agg_finalfn ( -internal -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_object_agg_finalfn'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object_agg_transfn(internal, "any", "any") CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3405; -CREATE FUNCTION pg_catalog.json_object_agg_transfn ( -internal, "any", "any" -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE as 'json_object_agg_transfn'; - -drop aggregate if exists pg_catalog.json_object_agg("any", "any"); -SET LOCAL inplace_upgrade_next_system_object_oids=IUO_PROC, 3403; -create aggregate pg_catalog.json_object_agg("any", "any") (SFUNC=json_object_agg_transfn, STYPE= internal, finalfunc = json_object_agg_finalfn); - - ----------------------------------------------------------------- --- modify normal funcs ----------------------------------------------------------------- -ALTER FUNCTION json_in(cstring) IMMUTABLE; -ALTER FUNCTION json_send(json) IMMUTABLE; -ALTER FUNCTION json_recv(internal) IMMUTABLE; - - ----------------------------------------------------------------- --- add normal funcs ----------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.gin_compare_jsonb(text, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3498; -CREATE FUNCTION pg_catalog.gin_compare_jsonb ( -text, text -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_compare_jsonb'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_consistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3497; -CREATE FUNCTION pg_catalog.gin_consistent_jsonb ( -internal, smallint, anyarray, integer, internal, internal, internal, internal -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_consistent_jsonb'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_consistent_jsonb_hash(internal, smallint, anyarray, integer, internal, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3487; -CREATE FUNCTION pg_catalog.gin_consistent_jsonb_hash ( -internal, smallint, anyarray, integer, internal, internal, internal, internal -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_consistent_jsonb_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb(internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3482; -CREATE FUNCTION pg_catalog.gin_extract_jsonb ( -internal, internal, internal -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_extract_jsonb'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_hash(internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3492; -CREATE FUNCTION pg_catalog.gin_extract_jsonb_hash ( -internal, internal, internal -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_extract_jsonb_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_query(anyarray, internal, smallint, internal, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3493; -CREATE FUNCTION pg_catalog.gin_extract_jsonb_query ( -anyarray, internal, smallint, internal, internal, internal, internal -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_extract_jsonb_query'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_extract_jsonb_query_hash(anyarray, internal, smallint, internal, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3486; -CREATE FUNCTION pg_catalog.gin_extract_jsonb_query_hash ( -anyarray, internal, smallint, internal, internal, internal, internal -) RETURNS internal LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_extract_jsonb_query_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_triconsistent_jsonb(internal, smallint, anyarray, integer, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3494; -CREATE FUNCTION pg_catalog.gin_triconsistent_jsonb ( -internal, smallint, anyarray, integer, internal, internal, internal -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_triconsistent_jsonb'; - -DROP FUNCTION IF EXISTS pg_catalog.gin_triconsistent_jsonb_hash(internal, smallint, anyarray, integer, internal, internal, internal) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3495; -CREATE FUNCTION pg_catalog.gin_triconsistent_jsonb_hash ( -internal, smallint, anyarray, integer, internal, internal, internal -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'gin_triconsistent_jsonb_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_element(json, integer) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3949; -CREATE FUNCTION pg_catalog.json_array_element ( -json, integer -) RETURNS json LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_array_element'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_element_text(json, integer) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3079; -CREATE FUNCTION pg_catalog.json_array_element_text ( -json, integer -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_array_element_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_elements(from_json json, OUT value json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3549; -CREATE FUNCTION pg_catalog.json_array_elements ( -from_json json, OUT value json -) RETURNS SETOF json LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_array_elements'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_elements_text(from_json json, OUT value text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3127; -CREATE FUNCTION pg_catalog.json_array_elements_text ( -from_json json, OUT value text -) RETURNS SETOF text LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_array_elements_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_array_length(json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3128; -CREATE FUNCTION pg_catalog.json_array_length ( -json -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_array_length'; - -DROP FUNCTION IF EXISTS pg_catalog.json_build_array() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3238; -CREATE FUNCTION pg_catalog.json_build_array ( - -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_build_array_noargs'; - -DROP FUNCTION IF EXISTS pg_catalog.json_build_array(VARIADIC "any") CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3239; -CREATE FUNCTION pg_catalog.json_build_array ( -VARIADIC "any" -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_build_array'; - -DROP FUNCTION IF EXISTS pg_catalog.json_build_object() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3260; -CREATE FUNCTION pg_catalog.json_build_object ( - -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_build_object_noargs'; - -DROP FUNCTION IF EXISTS pg_catalog.json_build_object(VARIADIC "any") CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3261; -CREATE FUNCTION pg_catalog.json_build_object ( -VARIADIC "any" -) RETURNS json LANGUAGE INTERNAL IMMUTABLE as 'json_build_object'; - -DROP FUNCTION IF EXISTS pg_catalog.json_each(from_json json, OUT key text, OUT value json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3258; -CREATE FUNCTION pg_catalog.json_each ( -from_json json, OUT key text, OUT value json -) RETURNS SETOF record LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_each'; - -DROP FUNCTION IF EXISTS pg_catalog.json_each_text(from_json json, OUT key text, OUT value text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3259; -CREATE FUNCTION pg_catalog.json_each_text ( -from_json json, OUT key text, OUT value text -) RETURNS SETOF record LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_each_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path(json, VARIADIC text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3262; -CREATE FUNCTION pg_catalog.json_extract_path ( -json, VARIADIC text[] -) RETURNS json LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_extract_path'; - -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_op(json, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3263; -CREATE FUNCTION pg_catalog.json_extract_path_op ( -json, text[] -) RETURNS json LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_extract_path'; - -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_text(json, VARIADIC text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3264; -CREATE FUNCTION pg_catalog.json_extract_path_text ( -json, VARIADIC text[] -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_extract_path_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_extract_path_text_op(json, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3318; -CREATE FUNCTION pg_catalog.json_extract_path_text_op ( -json, text[] -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_extract_path_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object(text[], text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3401; -CREATE FUNCTION pg_catalog.json_object ( -text[], text[] -) RETURNS json LANGUAGE INTERNAL STABLE STRICT as 'json_object_two_arg'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object(text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3402; -CREATE FUNCTION pg_catalog.json_object ( -text[] -) RETURNS json LANGUAGE INTERNAL STABLE STRICT as 'json_object'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object_field(json, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3406; -CREATE FUNCTION pg_catalog.json_object_field ( -json, text -) RETURNS json LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_object_field'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object_field_text(json, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3948; -CREATE FUNCTION pg_catalog.json_object_field_text ( -json, text -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_object_field_text'; - -DROP FUNCTION IF EXISTS pg_catalog.json_object_keys(json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3407; -CREATE FUNCTION pg_catalog.json_object_keys ( -json -) RETURNS SETOF text LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'json_object_keys'; - -DROP FUNCTION IF EXISTS pg_catalog.json_populate_record(anyelement, json, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3408; -CREATE FUNCTION pg_catalog.json_populate_record ( -anyelement, json, boolean DEFAULT false -) RETURNS anyelement LANGUAGE INTERNAL STABLE as 'json_populate_record'; - -DROP FUNCTION IF EXISTS pg_catalog.json_populate_recordset(anyelement, json, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3409; -CREATE FUNCTION pg_catalog.json_populate_recordset ( -anyelement, json, boolean DEFAULT false -) RETURNS SETOF anyelement LANGUAGE INTERNAL ROWS 100 STABLE as 'json_populate_recordset'; - -DROP FUNCTION IF EXISTS pg_catalog.json_to_record(json, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3410; -CREATE FUNCTION pg_catalog.json_to_record ( -json, boolean -) RETURNS record LANGUAGE INTERNAL STABLE as 'json_to_record'; - -DROP FUNCTION IF EXISTS pg_catalog.json_to_recordset(json, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3411; -CREATE FUNCTION pg_catalog.json_to_recordset ( -json, boolean -) RETURNS SETOF record LANGUAGE INTERNAL STABLE ROWS 100 as 'json_to_recordset'; - -DROP FUNCTION IF EXISTS pg_catalog.json_typeof(json) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3270; -CREATE FUNCTION pg_catalog.json_typeof ( -json -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'json_typeof'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_element(jsonb, integer) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3412; -CREATE FUNCTION pg_catalog.jsonb_array_element ( -jsonb, integer -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_array_element'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_element_text(jsonb, integer) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3413; -CREATE FUNCTION pg_catalog.jsonb_array_element_text ( -jsonb, integer -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_array_element_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_elements(from_json jsonb, OUT value jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3414; -CREATE FUNCTION pg_catalog.jsonb_array_elements ( -from_json jsonb, OUT value jsonb -) RETURNS SETOF jsonb LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_array_elements'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_elements_text(from_json jsonb, OUT value text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3415; -CREATE FUNCTION pg_catalog.jsonb_array_elements_text ( -from_json jsonb, OUT value text -) RETURNS SETOF text LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_array_elements_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_array_length(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3416; -CREATE FUNCTION pg_catalog.jsonb_array_length ( -jsonb -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_array_length'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_cmp(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3417; -CREATE FUNCTION pg_catalog.jsonb_cmp ( -jsonb, jsonb -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_cmp'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_contained(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4050; -CREATE FUNCTION pg_catalog.jsonb_contained ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_contained'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_contains(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3418; -CREATE FUNCTION pg_catalog.jsonb_contains ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_contains'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_each(from_json jsonb, OUT key text, OUT value jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3419; -CREATE FUNCTION pg_catalog.jsonb_each ( -from_json jsonb, OUT key text, OUT value jsonb -) RETURNS SETOF record LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_each'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_each_text(from_json jsonb, OUT key text, OUT value text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3420; -CREATE FUNCTION pg_catalog.jsonb_each_text ( -from_json jsonb, OUT key text, OUT value text -) RETURNS SETOF record LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_each_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_eq(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3421; -CREATE FUNCTION pg_catalog.jsonb_eq ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_eq'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists(jsonb, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3422; -CREATE FUNCTION pg_catalog.jsonb_exists ( -jsonb, text -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_exists'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists_all(jsonb, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3423; -CREATE FUNCTION pg_catalog.jsonb_exists_all ( -jsonb, text[] -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_exists_all'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_exists_any(jsonb, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3424; -CREATE FUNCTION pg_catalog.jsonb_exists_any ( -jsonb, text[] -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_exists_any'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path(jsonb, VARIADIC text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3425; -CREATE FUNCTION pg_catalog.jsonb_extract_path ( -jsonb, VARIADIC text[] -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_extract_path'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_op(jsonb, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3319; -CREATE FUNCTION pg_catalog.jsonb_extract_path_op ( -jsonb, text[] -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_extract_path'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_text(jsonb, VARIADIC text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3426; -CREATE FUNCTION pg_catalog.jsonb_extract_path_text ( -jsonb, VARIADIC text[] -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_extract_path_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_extract_path_text_op(jsonb, text[]) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3427; -CREATE FUNCTION pg_catalog.jsonb_extract_path_text_op ( -jsonb, text[] -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_extract_path_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_ge(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3428; -CREATE FUNCTION pg_catalog.jsonb_ge ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_ge'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_gt(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3429; -CREATE FUNCTION pg_catalog.jsonb_gt ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_gt'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_hash(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3430; -CREATE FUNCTION pg_catalog.jsonb_hash ( -jsonb -) RETURNS integer LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_hash'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_le(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3431; -CREATE FUNCTION pg_catalog.jsonb_le ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_le'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_lt(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4039; -CREATE FUNCTION pg_catalog.jsonb_lt ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_lt'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_ne(jsonb, jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3432; -CREATE FUNCTION pg_catalog.jsonb_ne ( -jsonb, jsonb -) RETURNS boolean LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_ne'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_field(jsonb, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3433; -CREATE FUNCTION pg_catalog.jsonb_object_field ( -jsonb, text -) RETURNS jsonb LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_object_field'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_field_text(jsonb, text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3434; -CREATE FUNCTION pg_catalog.jsonb_object_field_text ( -jsonb, text -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_object_field_text'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_object_keys(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3435; -CREATE FUNCTION pg_catalog.jsonb_object_keys ( -jsonb -) RETURNS SETOF text LANGUAGE INTERNAL IMMUTABLE ROWS 100 STRICT as 'jsonb_object_keys'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_populate_record(anyelement, jsonb, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3437; -CREATE FUNCTION pg_catalog.jsonb_populate_record ( -anyelement, jsonb, boolean DEFAULT false -) RETURNS anyelement LANGUAGE INTERNAL STABLE as 'jsonb_populate_record'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_populate_recordset(anyelement, jsonb, boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3438; -CREATE FUNCTION pg_catalog.jsonb_populate_recordset ( -anyelement, jsonb, boolean DEFAULT false -) RETURNS SETOF anyelement LANGUAGE INTERNAL STABLE ROWS 100 as 'jsonb_populate_recordset'; - -DROP FUNCTION IF EXISTS pg_catalog.jsonb_typeof(jsonb) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3445; -CREATE FUNCTION pg_catalog.jsonb_typeof ( -jsonb -) RETURNS text LANGUAGE INTERNAL IMMUTABLE STRICT as 'jsonb_typeof'; - -DROP FUNCTION IF EXISTS pg_catalog.to_json(anyelement) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 3446; -CREATE FUNCTION pg_catalog.to_json ( -anyelement -) RETURNS json LANGUAGE INTERNAL STABLE STRICT as 'to_json'; - - --------------------------------------------------------------- --- add new operator --------------------------------------------------------------- -DROP OPERATOR IF EXISTS pg_catalog.->(json, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3962; -CREATE OPERATOR pg_catalog.->( -leftarg = json, rightarg = text, procedure = json_object_field -); -COMMENT ON OPERATOR pg_catalog.->(json, text) IS 'json_object_field'; - -DROP OPERATOR IF EXISTS pg_catalog.->>(json, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3963; -CREATE OPERATOR pg_catalog.->>( -leftarg = json, rightarg = text, procedure = json_object_field_text -); -COMMENT ON OPERATOR pg_catalog.->>(json, text) IS 'json_object_field_text'; - -DROP OPERATOR IF EXISTS pg_catalog.->(json, integer) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3964; -CREATE OPERATOR pg_catalog.->( -leftarg = json, rightarg = integer, procedure = json_array_element -); -COMMENT ON OPERATOR pg_catalog.->(json, integer) IS 'json_array_element'; - -DROP OPERATOR IF EXISTS pg_catalog.->>(json, integer) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3965; -CREATE OPERATOR pg_catalog.->>( -leftarg = json, rightarg = integer, procedure = json_array_element_text -); -COMMENT ON OPERATOR pg_catalog.->>(json, integer) IS 'json_array_element_text'; - -DROP OPERATOR IF EXISTS pg_catalog.#>(json, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3966; -CREATE OPERATOR pg_catalog.#>( -leftarg = json, rightarg = _text, procedure = json_extract_path_op -); -COMMENT ON OPERATOR pg_catalog.#>(json, _text) IS 'json_extract_path_op'; - -DROP OPERATOR IF EXISTS pg_catalog.#>>(json, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3967; -CREATE OPERATOR pg_catalog.#>>( -leftarg = json, rightarg = _text, procedure = json_extract_path_text_op -); -COMMENT ON OPERATOR pg_catalog.#>>(json, _text) IS 'json_extract_path_text_op'; - -DROP OPERATOR IF EXISTS pg_catalog.->(jsonb, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3211; -CREATE OPERATOR pg_catalog.->( -leftarg = jsonb, rightarg = text, procedure = jsonb_object_field -); -COMMENT ON OPERATOR pg_catalog.->(jsonb, text) IS 'jsonb_object_field'; - -DROP OPERATOR IF EXISTS pg_catalog.->>(jsonb, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3477; -CREATE OPERATOR pg_catalog.->>( -leftarg = jsonb, rightarg = text, procedure = jsonb_object_field_text -); -COMMENT ON OPERATOR pg_catalog.->>(jsonb, text) IS 'jsonb_object_field_text'; - -DROP OPERATOR IF EXISTS pg_catalog.->(jsonb, integer) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3212; -CREATE OPERATOR pg_catalog.->( -leftarg = jsonb, rightarg = integer, procedure = jsonb_array_element -); -COMMENT ON OPERATOR pg_catalog.->(jsonb, integer) IS 'jsonb_array_element'; - -DROP OPERATOR IF EXISTS pg_catalog.->>(jsonb, integer) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3481; -CREATE OPERATOR pg_catalog.->>( -leftarg = jsonb, rightarg = integer, procedure = jsonb_array_element_text -); -COMMENT ON OPERATOR pg_catalog.->>(jsonb, integer) IS 'jsonb_array_element_text'; - -DROP OPERATOR IF EXISTS pg_catalog.#>(jsonb, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3213; -CREATE OPERATOR pg_catalog.#>( -leftarg = jsonb, rightarg = _text, procedure = jsonb_extract_path_op -); -COMMENT ON OPERATOR pg_catalog.#>(jsonb, _text) IS 'jsonb_extract_path_op'; - -DROP OPERATOR IF EXISTS pg_catalog.#>>(jsonb, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3206; -CREATE OPERATOR pg_catalog.#>>( -leftarg = jsonb, rightarg = _text, procedure = jsonb_extract_path_text_op -); -COMMENT ON OPERATOR pg_catalog.#>>(jsonb, _text) IS 'jsonb_extract_path_text_op'; - -DROP OPERATOR IF EXISTS pg_catalog.=(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3240; -CREATE OPERATOR pg_catalog.=( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_eq, -commutator=operator(pg_catalog.=), -restrict = eqsel, join = eqjoinsel, -HASHES, MERGES -); -COMMENT ON OPERATOR pg_catalog.=(jsonb, jsonb) IS 'jsonb_eq'; - -DROP OPERATOR IF EXISTS pg_catalog.<>(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3241; -CREATE OPERATOR pg_catalog.<>( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_ne, -commutator=operator(pg_catalog.<>), negator=operator(pg_catalog.=), -restrict = neqsel, join = neqjoinsel -); -COMMENT ON OPERATOR pg_catalog.<>(jsonb, jsonb) IS 'jsonb_ne'; - -DROP OPERATOR IF EXISTS pg_catalog.<(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3242; -CREATE OPERATOR pg_catalog.<( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_lt, -restrict = scalarltsel, join = scalarltjoinsel -); -COMMENT ON OPERATOR pg_catalog.<(jsonb, jsonb) IS 'jsonb_lt'; - -DROP OPERATOR IF EXISTS pg_catalog.>(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3243; -CREATE OPERATOR pg_catalog.>( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_gt, -commutator=operator(pg_catalog.<), -restrict = scalargtsel, join = scalargtjoinsel -); -COMMENT ON OPERATOR pg_catalog.>(jsonb, jsonb) IS 'jsonb_gt'; - -DROP OPERATOR IF EXISTS pg_catalog.<=(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3244; -CREATE OPERATOR pg_catalog.<=( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_le, -negator=operator(pg_catalog.>), -restrict = scalarltsel, join = scalarltjoinsel -); -COMMENT ON OPERATOR pg_catalog.<=(jsonb, jsonb) IS 'jsonb_le'; - -DROP OPERATOR IF EXISTS pg_catalog.>=(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3245; -CREATE OPERATOR pg_catalog.>=( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_ge, -commutator=operator(pg_catalog.<=), negator=operator(pg_catalog.<), -restrict = scalargtsel, join = scalargtjoinsel -); -COMMENT ON OPERATOR pg_catalog.>=(jsonb, jsonb) IS 'jsonb_ge'; - -DROP OPERATOR IF EXISTS pg_catalog.@>(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3246; -CREATE OPERATOR pg_catalog.@>( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_contains, -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.@>(jsonb, jsonb) IS 'jsonb_contains'; - -DROP OPERATOR IF EXISTS pg_catalog.?(jsonb, text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3247; -CREATE OPERATOR pg_catalog.?( -leftarg = jsonb, rightarg = text, procedure = jsonb_exists, -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.?(jsonb, text) IS 'jsonb_exists'; - -DROP OPERATOR IF EXISTS pg_catalog.?|(jsonb, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3248; -CREATE OPERATOR pg_catalog.?|( -leftarg = jsonb, rightarg = _text, procedure = jsonb_exists_any, -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.?|(jsonb, _text) IS 'jsonb_exists_any'; - -DROP OPERATOR IF EXISTS pg_catalog.?&(jsonb, _text) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3249; -CREATE OPERATOR pg_catalog.?&( -leftarg = jsonb, rightarg = _text, procedure = jsonb_exists_all, -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.?&(jsonb, _text) IS 'jsonb_exists_all'; - -DROP OPERATOR IF EXISTS pg_catalog.<@(jsonb, jsonb) cascade; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 3250; -CREATE OPERATOR pg_catalog.<@( -leftarg = jsonb, rightarg = jsonb, procedure = jsonb_contained, -negator=operator(pg_catalog.@>), -restrict = contsel, join = contjoinsel -); -COMMENT ON OPERATOR pg_catalog.<@(jsonb, jsonb) IS 'jsonb_contained'; - - --------------------------------------------------------------- --- add pg_opfamily --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Insert_pg_opfamily_temp( -IN imethod integer, -IN iname text, -IN inamespace integer, -IN iowner integer -) -RETURNS void -AS $$ -DECLARE - row_name record; - query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - insert into pg_catalog.pg_opfamily values (imethod, iname, inamespace, iowner); - END LOOP; - return; -END; $$ -LANGUAGE 'plpgsql'; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4033; -select Insert_pg_opfamily_temp(403, 'jsonb_ops', 11, 10); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4034; -select Insert_pg_opfamily_temp(405, 'jsonb_ops', 11, 10); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4035; -select Insert_pg_opfamily_temp(783, 'jsonb_ops', 11, 10); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4036; -select Insert_pg_opfamily_temp(2742, 'jsonb_ops', 11, 10); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_GENERAL, 4037; -select Insert_pg_opfamily_temp(2742, 'jsonb_hash_ops', 11, 10); - -DROP FUNCTION Insert_pg_opfamily_temp(); - - --------------------------------------------------------------- --- add pg_cast --------------------------------------------------------------- -DROP CAST IF EXISTS (json AS jsonb) CASCADE; -CREATE CAST(json AS jsonb) WITH INOUT; - -DROP CAST IF EXISTS (jsonb AS json) CASCADE; -CREATE CAST(jsonb AS json) WITH INOUT; - - --------------------------------------------------------------- --- add pg_opclass --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Insert_pg_opclass_temp( -IN icmethod integer, -IN icname text, -IN icnamespace integer, -IN icowner integer, -IN icfamily integer, -IN icintype integer, -IN icdefault boolean, -IN ickeytype integer -) -RETURNS void -AS $$ -DECLARE - row_name record; - query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - insert into pg_catalog.pg_opclass values (icmethod, icname, icnamespace, icowner, icfamily, icintype, icdefault, ickeytype); - END LOOP; - return; -END; $$ -LANGUAGE 'plpgsql'; - -select Insert_pg_opclass_temp(403, 'jsonb_ops', 11, 10, 4033, 3802, true, 0); - -select Insert_pg_opclass_temp(405, 'jsonb_ops', 11, 10, 4034, 3802, true, 0); - -select Insert_pg_opclass_temp(2742, 'jsonb_ops', 11, 10, 4036, 3802, true, 25); - -select Insert_pg_opclass_temp(2742, 'jsonb_hash_ops', 11, 10, 4037, 3802, false, 23); - -DROP FUNCTION Insert_pg_opclass_temp(); - - - --------------------------------------------------------------- --- add pg_amproc --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Insert_pg_amproc_temp( -IN iprocfamily oid, -IN iproclefttype oid, -IN iprocrighttype oid, -IN iprocnum smallint, -IN iproc regproc -) -RETURNS void -AS $$ -DECLARE - row_name record; - query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - insert into pg_catalog.pg_amproc values (iprocfamily, iproclefttype, iprocrighttype, iprocnum, iproc); - END LOOP; - return; -END; $$ -LANGUAGE 'plpgsql'; - -SELECT Insert_pg_amproc_temp(4033, 3802, 3802, 1, 3417); - -SELECT Insert_pg_amproc_temp(4034, 3802, 3802, 1, 3430); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 1, 3498); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 2, 3482); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 3, 3493); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 4, 3497); - -SELECT Insert_pg_amproc_temp(4036, 3802, 3802, 6, 3494); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 1, 351); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 2, 3492); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 3, 3486); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 4, 3487); - -SELECT Insert_pg_amproc_temp(4037, 3802, 3802, 6, 3495); - -DROP FUNCTION Insert_pg_amproc_temp(); - - --------------------------------------------------------------- --- add pg_amop --------------------------------------------------------------- -CREATE OR REPLACE FUNCTION Insert_pg_amop_temp( -IN iopfamily integer, -IN ioplefttype integer, -IN ioprighttype integer, -IN iopstrategy integer, -IN ioppurpose character, -IN iopopr integer, -IN iopmethod integer, -IN iopsortfamily integer -) -RETURNS void -AS $$ -DECLARE - row_name record; - query_str_nodes text; -BEGIN - query_str_nodes := 'select * from dbe_perf.node_name'; - FOR row_name IN EXECUTE(query_str_nodes) LOOP - insert into pg_catalog.pg_amop values (iopfamily, ioplefttype, ioprighttype, iopstrategy, ioppurpose, iopopr, iopmethod, iopsortfamily); - END LOOP; - return; -END; $$ -LANGUAGE 'plpgsql'; - -select Insert_pg_amop_temp(4033, 3802, 3802, 1, 's', 3242, 403, 0); - -select Insert_pg_amop_temp(4033, 3802, 3802, 2, 's', 3244, 403, 0); - -select Insert_pg_amop_temp(4033, 3802, 3802, 3, 's', 3240, 403, 0); - -select Insert_pg_amop_temp(4033, 3802, 3802, 4, 's', 3245, 403, 0); - -select Insert_pg_amop_temp(4033, 3802, 3802, 5, 's', 3243, 403, 0); - -select Insert_pg_amop_temp(4034, 3802, 3802, 1, 's', 3240, 405, 0); - -select Insert_pg_amop_temp(4036, 3802, 3802, 7, 's', 3246, 2742, 0); - -select Insert_pg_amop_temp(4036, 3802, 25, 9, 's', 3247, 2742, 0); - -select Insert_pg_amop_temp(4036, 3802, 1009, 10, 's', 3248, 2742, 0); - -select Insert_pg_amop_temp(4036, 3802, 1009, 11, 's', 3249, 2742, 0); - -select Insert_pg_amop_temp(4037, 3802, 3802, 7, 's', 3246, 2742, 0); - -drop function Insert_pg_amop_temp(); -SET search_path TO information_schema; - --- element_types is generated by data_type_privileges -DROP VIEW IF EXISTS information_schema.element_types CASCADE; - --- data_type_privileges is generated by columns -DROP VIEW IF EXISTS information_schema.data_type_privileges CASCADE; --- data_type_privileges is generated by table_privileges -DROP VIEW IF EXISTS information_schema.role_column_grants CASCADE; --- data_type_privileges is generated by column_privileges -DROP VIEW IF EXISTS information_schema.role_table_grants CASCADE; - --- other views need upgrade for matview -DROP VIEW IF EXISTS information_schema.column_domain_usage CASCADE; -DROP VIEW IF EXISTS information_schema.column_privileges CASCADE; -DROP VIEW IF EXISTS information_schema.column_udt_usage CASCADE; -DROP VIEW IF EXISTS information_schema.columns CASCADE; -DROP VIEW IF EXISTS information_schema.table_privileges CASCADE; -DROP VIEW IF EXISTS information_schema.tables CASCADE; -DROP VIEW IF EXISTS information_schema.view_column_usage CASCADE; -DROP VIEW IF EXISTS information_schema.view_table_usage CASCADE; - -CREATE VIEW information_schema.column_domain_usage AS - SELECT CAST(current_database() AS sql_identifier) AS domain_catalog, - CAST(nt.nspname AS sql_identifier) AS domain_schema, - CAST(t.typname AS sql_identifier) AS domain_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_type t, pg_namespace nt, pg_class c, pg_namespace nc, - pg_attribute a - - WHERE t.typnamespace = nt.oid - AND c.relnamespace = nc.oid - AND a.attrelid = c.oid - AND a.atttypid = t.oid - AND t.typtype = 'd' - AND c.relkind IN ('r', 'm', 'v', 'f') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND a.attnum > 0 - AND NOT a.attisdropped - AND pg_has_role(t.typowner, 'USAGE'); - -CREATE VIEW information_schema.column_privileges AS - SELECT CAST(u_grantor.rolname AS sql_identifier) AS grantor, - CAST(grantee.rolname AS sql_identifier) AS grantee, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(x.relname AS sql_identifier) AS table_name, - CAST(x.attname AS sql_identifier) AS column_name, - CAST(x.prtype AS character_data) AS privilege_type, - CAST( - CASE WHEN - -- object owner always has grant options - pg_has_role(x.grantee, x.relowner, 'USAGE') - OR x.grantable - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable - - FROM ( - SELECT pr_c.grantor, - pr_c.grantee, - attname, - relname, - relnamespace, - pr_c.prtype, - pr_c.grantable, - pr_c.relowner - FROM (SELECT oid, relname, relnamespace, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).* - FROM pg_class - WHERE relkind IN ('r', 'm', 'v', 'f') - ) pr_c (oid, relname, relnamespace, relowner, grantor, grantee, prtype, grantable), - pg_attribute a - WHERE a.attrelid = pr_c.oid - AND a.attnum > 0 - AND NOT a.attisdropped - UNION - SELECT pr_a.grantor, - pr_a.grantee, - attname, - relname, - relnamespace, - pr_a.prtype, - pr_a.grantable, - c.relowner - FROM (SELECT attrelid, attname, (aclexplode(coalesce(attacl, acldefault('c', relowner)))).* - FROM pg_attribute a JOIN pg_class cc ON (a.attrelid = cc.oid) - WHERE attnum > 0 - AND NOT attisdropped - ) pr_a (attrelid, attname, grantor, grantee, prtype, grantable), - pg_class c - WHERE pr_a.attrelid = c.oid - AND relkind IN ('r', 'm', 'v', 'f') - ) x, - pg_namespace nc, - pg_authid u_grantor, - ( - SELECT oid, rolname FROM pg_authid - UNION ALL - SELECT 0::oid, 'PUBLIC' - ) AS grantee (oid, rolname) - - WHERE x.relnamespace = nc.oid - AND x.grantee = grantee.oid - AND x.grantor = u_grantor.oid - AND x.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'REFERENCES', 'COMMENT') - AND (x.relname not like 'mlog_%' AND x.relname not like 'matviewmap_%') - AND (pg_has_role(u_grantor.oid, 'USAGE') - OR pg_has_role(grantee.oid, 'USAGE') - OR grantee.rolname = 'PUBLIC'); - -CREATE VIEW information_schema.column_udt_usage AS - SELECT CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(coalesce(nbt.nspname, nt.nspname) AS sql_identifier) AS udt_schema, - CAST(coalesce(bt.typname, t.typname) AS sql_identifier) AS udt_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_attribute a, pg_class c, pg_namespace nc, - (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) - ON (t.typtype = 'd' AND t.typbasetype = bt.oid) - - WHERE a.attrelid = c.oid - AND a.atttypid = t.oid - AND nc.oid = c.relnamespace - AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'm', 'v', 'f') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND pg_has_role(coalesce(bt.typowner, t.typowner), 'USAGE'); - -CREATE VIEW information_schema.columns AS - SELECT CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name, - CAST(a.attnum AS cardinal_number) AS ordinal_position, - CAST(CASE WHEN ad.adgencol <> 's' THEN pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS column_default, - CAST(CASE WHEN a.attnotnull OR (t.typtype = 'd' AND t.typnotnull) THEN 'NO' ELSE 'YES' END - AS yes_or_no) - AS is_nullable, - - CAST( - CASE WHEN t.typtype = 'd' THEN - CASE WHEN bt.typelem <> 0 AND bt.typlen = -1 THEN 'ARRAY' - WHEN nbt.nspname = 'pg_catalog' THEN format_type(t.typbasetype, null) - ELSE 'USER-DEFINED' END - ELSE - CASE WHEN t.typelem <> 0 AND t.typlen = -1 THEN 'ARRAY' - WHEN nt.nspname = 'pg_catalog' THEN format_type(a.atttypid, null) - ELSE 'USER-DEFINED' END - END - AS character_data) - AS data_type, - - CAST( - _pg_char_max_length(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS character_maximum_length, - - CAST( - _pg_char_octet_length(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS character_octet_length, - - CAST( - _pg_numeric_precision(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_precision, - - CAST( - _pg_numeric_precision_radix(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_precision_radix, - - CAST( - _pg_numeric_scale(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS numeric_scale, - - CAST( - _pg_datetime_precision(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS cardinal_number) - AS datetime_precision, - - CAST( - _pg_interval_type(_pg_truetypid(a, t), _pg_truetypmod(a, t)) - AS character_data) - AS interval_type, - CAST(null AS cardinal_number) AS interval_precision, - - CAST(null AS sql_identifier) AS character_set_catalog, - CAST(null AS sql_identifier) AS character_set_schema, - CAST(null AS sql_identifier) AS character_set_name, - - CAST(CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS sql_identifier) AS collation_catalog, - CAST(nco.nspname AS sql_identifier) AS collation_schema, - CAST(co.collname AS sql_identifier) AS collation_name, - - CAST(CASE WHEN t.typtype = 'd' THEN current_database() ELSE null END - AS sql_identifier) AS domain_catalog, - CAST(CASE WHEN t.typtype = 'd' THEN nt.nspname ELSE null END - AS sql_identifier) AS domain_schema, - CAST(CASE WHEN t.typtype = 'd' THEN t.typname ELSE null END - AS sql_identifier) AS domain_name, - - CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(coalesce(nbt.nspname, nt.nspname) AS sql_identifier) AS udt_schema, - CAST(coalesce(bt.typname, t.typname) AS sql_identifier) AS udt_name, - - CAST(null AS sql_identifier) AS scope_catalog, - CAST(null AS sql_identifier) AS scope_schema, - CAST(null AS sql_identifier) AS scope_name, - - CAST(null AS cardinal_number) AS maximum_cardinality, - CAST(a.attnum AS sql_identifier) AS dtd_identifier, - CAST('NO' AS yes_or_no) AS is_self_referencing, - - CAST('NO' AS yes_or_no) AS is_identity, - CAST(null AS character_data) AS identity_generation, - CAST(null AS character_data) AS identity_start, - CAST(null AS character_data) AS identity_increment, - CAST(null AS character_data) AS identity_maximum, - CAST(null AS character_data) AS identity_minimum, - CAST(null AS yes_or_no) AS identity_cycle, - - CAST(CASE WHEN ad.adgencol = 's' THEN 'ALWAYS' ELSE 'NEVER' END AS character_data) AS is_generated, - CAST(CASE WHEN ad.adgencol = 's' THEN pg_get_expr(ad.adbin, ad.adrelid) END AS character_data) AS generation_expression, - - CAST(CASE WHEN c.relkind = 'r' - OR (c.relkind = 'v' - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '2' AND is_instead) - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '4' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_updatable - - FROM (pg_attribute a LEFT JOIN pg_attrdef ad ON attrelid = adrelid AND attnum = adnum) - JOIN (pg_class c JOIN pg_namespace nc ON (c.relnamespace = nc.oid)) ON a.attrelid = c.oid - JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON a.atttypid = t.oid - LEFT JOIN (pg_type bt JOIN pg_namespace nbt ON (bt.typnamespace = nbt.oid)) - ON (t.typtype = 'd' AND t.typbasetype = bt.oid) - LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid)) - ON a.attcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default') - - WHERE (NOT pg_is_other_temp_schema(nc.oid)) - - AND a.attnum > 0 AND NOT a.attisdropped AND c.relkind in ('r', 'm', 'v', 'f') - - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - - AND (pg_has_role(c.relowner, 'USAGE') - OR has_column_privilege(c.oid, a.attnum, - 'SELECT, INSERT, UPDATE, REFERENCES')); - -CREATE VIEW information_schema.table_privileges AS - SELECT CAST(u_grantor.rolname AS sql_identifier) AS grantor, - CAST(grantee.rolname AS sql_identifier) AS grantee, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - CAST(c.prtype AS character_data) AS privilege_type, - CAST( - CASE WHEN - -- object owner always has grant options - pg_has_role(grantee.oid, c.relowner, 'USAGE') - OR c.grantable - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_grantable, - CAST(CASE WHEN c.prtype = 'SELECT' THEN 'YES' ELSE 'NO' END AS yes_or_no) AS with_hierarchy - - FROM ( - SELECT oid, relname, relnamespace, relkind, relowner, (aclexplode(coalesce(relacl, acldefault('r', relowner)))).* FROM pg_class - ) AS c (oid, relname, relnamespace, relkind, relowner, grantor, grantee, prtype, grantable), - pg_namespace nc, - pg_authid u_grantor, - ( - SELECT oid, rolname FROM pg_authid - UNION ALL - SELECT 0::oid, 'PUBLIC' - ) AS grantee (oid, rolname) - - WHERE c.relnamespace = nc.oid - AND c.relkind IN ('r', 'm', 'v') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND c.grantee = grantee.oid - AND c.grantor = u_grantor.oid - AND (c.prtype IN ('INSERT', 'SELECT', 'UPDATE', 'DELETE', 'TRUNCATE', 'REFERENCES', 'TRIGGER') - OR c.prtype IN ('ALTER', 'DROP', 'COMMENT', 'INDEX', 'VACUUM') - ) - AND (pg_has_role(u_grantor.oid, 'USAGE') - OR pg_has_role(grantee.oid, 'USAGE') - OR grantee.rolname = 'PUBLIC'); - -CREATE VIEW information_schema.tables AS - SELECT CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nc.nspname AS sql_identifier) AS table_schema, - CAST(c.relname AS sql_identifier) AS table_name, - - CAST( - CASE WHEN nc.oid = pg_my_temp_schema() THEN 'LOCAL TEMPORARY' - WHEN c.relkind = 'r' THEN 'BASE TABLE' - WHEN c.relkind = 'm' THEN 'MATERIALIZED VIEW' - WHEN c.relkind = 'v' THEN 'VIEW' - WHEN c.relkind = 'f' THEN 'FOREIGN TABLE' - ELSE null END - AS character_data) AS table_type, - - CAST(null AS sql_identifier) AS self_referencing_column_name, - CAST(null AS character_data) AS reference_generation, - - CAST(CASE WHEN t.typname IS NOT NULL THEN current_database() ELSE null END AS sql_identifier) AS user_defined_type_catalog, - CAST(nt.nspname AS sql_identifier) AS user_defined_type_schema, - CAST(t.typname AS sql_identifier) AS user_defined_type_name, - - CAST(CASE WHEN c.relkind = 'r' - OR (c.relkind = 'v' - AND EXISTS (SELECT 1 FROM pg_rewrite WHERE ev_class = c.oid AND ev_type = '3' AND is_instead)) - THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_insertable_into, - - CAST(CASE WHEN t.typname IS NOT NULL THEN 'YES' ELSE 'NO' END AS yes_or_no) AS is_typed, - CAST(null AS character_data) AS commit_action - - FROM pg_namespace nc JOIN pg_class c ON (nc.oid = c.relnamespace) - LEFT JOIN (pg_type t JOIN pg_namespace nt ON (t.typnamespace = nt.oid)) ON (c.reloftype = t.oid) - - WHERE c.relkind IN ('r', 'm', 'v', 'f') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND (NOT pg_is_other_temp_schema(nc.oid)) - AND (pg_has_role(c.relowner, 'USAGE') - OR has_table_privilege(c.oid, 'SELECT, INSERT, UPDATE, DELETE, TRUNCATE, REFERENCES, TRIGGER') - OR has_any_column_privilege(c.oid, 'SELECT, INSERT, UPDATE, REFERENCES') ); - -CREATE VIEW information_schema.view_column_usage AS - SELECT DISTINCT - CAST(current_database() AS sql_identifier) AS view_catalog, - CAST(nv.nspname AS sql_identifier) AS view_schema, - CAST(v.relname AS sql_identifier) AS view_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nt.nspname AS sql_identifier) AS table_schema, - CAST(t.relname AS sql_identifier) AS table_name, - CAST(a.attname AS sql_identifier) AS column_name - - FROM pg_namespace nv, pg_class v, pg_depend dv, - pg_depend dt, pg_class t, pg_namespace nt, - pg_attribute a - - WHERE nv.oid = v.relnamespace - AND v.relkind = 'v' - AND v.oid = dv.refobjid - AND dv.refclassid = 'pg_catalog.pg_class'::regclass - AND dv.classid = 'pg_catalog.pg_rewrite'::regclass - AND dv.deptype = 'i' - AND dv.objid = dt.objid - AND dv.refobjid <> dt.refobjid - AND dt.classid = 'pg_catalog.pg_rewrite'::regclass - AND dt.refclassid = 'pg_catalog.pg_class'::regclass - AND dt.refobjid = t.oid - AND t.relnamespace = nt.oid - AND t.relkind IN ('r', 'm', 'v', 'f') - AND (t.relname not like 'mlog_%' AND t.relname not like 'matviewmap_%') - AND t.oid = a.attrelid - AND dt.refobjsubid = a.attnum - AND pg_has_role(t.relowner, 'USAGE'); - -CREATE VIEW information_schema.view_table_usage AS - SELECT DISTINCT - CAST(current_database() AS sql_identifier) AS view_catalog, - CAST(nv.nspname AS sql_identifier) AS view_schema, - CAST(v.relname AS sql_identifier) AS view_name, - CAST(current_database() AS sql_identifier) AS table_catalog, - CAST(nt.nspname AS sql_identifier) AS table_schema, - CAST(t.relname AS sql_identifier) AS table_name - - FROM pg_namespace nv, pg_class v, pg_depend dv, - pg_depend dt, pg_class t, pg_namespace nt - - WHERE nv.oid = v.relnamespace - AND v.relkind = 'v' - AND v.oid = dv.refobjid - AND dv.refclassid = 'pg_catalog.pg_class'::regclass - AND dv.classid = 'pg_catalog.pg_rewrite'::regclass - AND dv.deptype = 'i' - AND dv.objid = dt.objid - AND dv.refobjid <> dt.refobjid - AND dt.classid = 'pg_catalog.pg_rewrite'::regclass - AND dt.refclassid = 'pg_catalog.pg_class'::regclass - AND dt.refobjid = t.oid - AND t.relnamespace = nt.oid - AND t.relkind IN ('r', 'm', 'v', 'f') - AND (t.relname not like 'mlog_%' AND t.relname not like 'matviewmap_%') - AND pg_has_role(t.relowner, 'USAGE'); - -CREATE VIEW information_schema.data_type_privileges AS - SELECT CAST(current_database() AS sql_identifier) AS object_catalog, - CAST(x.objschema AS sql_identifier) AS object_schema, - CAST(x.objname AS sql_identifier) AS object_name, - CAST(x.objtype AS character_data) AS object_type, - CAST(x.objdtdid AS sql_identifier) AS dtd_identifier - - FROM - ( - SELECT udt_schema, udt_name, 'USER-DEFINED TYPE'::text, dtd_identifier FROM attributes - UNION ALL - SELECT table_schema, table_name, 'TABLE'::text, dtd_identifier FROM columns - UNION ALL - SELECT domain_schema, domain_name, 'DOMAIN'::text, dtd_identifier FROM domains - UNION ALL - SELECT specific_schema, specific_name, 'ROUTINE'::text, dtd_identifier FROM parameters - UNION ALL - SELECT specific_schema, specific_name, 'ROUTINE'::text, dtd_identifier FROM routines - ) AS x (objschema, objname, objtype, objdtdid); - -CREATE VIEW information_schema.role_column_grants AS - SELECT grantor, - grantee, - table_catalog, - table_schema, - table_name, - column_name, - privilege_type, - is_grantable - FROM column_privileges - WHERE grantor IN (SELECT role_name FROM enabled_roles) - OR grantee IN (SELECT role_name FROM enabled_roles); - -CREATE VIEW information_schema.role_table_grants AS - SELECT grantor, - grantee, - table_catalog, - table_schema, - table_name, - privilege_type, - is_grantable, - with_hierarchy - FROM table_privileges - WHERE grantor IN (SELECT role_name FROM enabled_roles) - OR grantee IN (SELECT role_name FROM enabled_roles); - -CREATE VIEW information_schema.element_types AS - SELECT CAST(current_database() AS sql_identifier) AS object_catalog, - CAST(n.nspname AS sql_identifier) AS object_schema, - CAST(x.objname AS sql_identifier) AS object_name, - CAST(x.objtype AS character_data) AS object_type, - CAST(x.objdtdid AS sql_identifier) AS collection_type_identifier, - CAST( - CASE WHEN nbt.nspname = 'pg_catalog' THEN format_type(bt.oid, null) - ELSE 'USER-DEFINED' END AS character_data) AS data_type, - - CAST(null AS cardinal_number) AS character_maximum_length, - CAST(null AS cardinal_number) AS character_octet_length, - CAST(null AS sql_identifier) AS character_set_catalog, - CAST(null AS sql_identifier) AS character_set_schema, - CAST(null AS sql_identifier) AS character_set_name, - CAST(CASE WHEN nco.nspname IS NOT NULL THEN current_database() END AS sql_identifier) AS collation_catalog, - CAST(nco.nspname AS sql_identifier) AS collation_schema, - CAST(co.collname AS sql_identifier) AS collation_name, - CAST(null AS cardinal_number) AS numeric_precision, - CAST(null AS cardinal_number) AS numeric_precision_radix, - CAST(null AS cardinal_number) AS numeric_scale, - CAST(null AS cardinal_number) AS datetime_precision, - CAST(null AS character_data) AS interval_type, - CAST(null AS cardinal_number) AS interval_precision, - - CAST(null AS character_data) AS domain_default, -- XXX maybe a bug in the standard - - CAST(current_database() AS sql_identifier) AS udt_catalog, - CAST(nbt.nspname AS sql_identifier) AS udt_schema, - CAST(bt.typname AS sql_identifier) AS udt_name, - - CAST(null AS sql_identifier) AS scope_catalog, - CAST(null AS sql_identifier) AS scope_schema, - CAST(null AS sql_identifier) AS scope_name, - - CAST(null AS cardinal_number) AS maximum_cardinality, - CAST('a' || CAST(x.objdtdid AS text) AS sql_identifier) AS dtd_identifier - - FROM pg_namespace n, pg_type at, pg_namespace nbt, pg_type bt, - ( - /* columns, attributes */ - SELECT c.relnamespace, CAST(c.relname AS sql_identifier), - CASE WHEN c.relkind = 'c' THEN 'USER-DEFINED TYPE'::text ELSE 'TABLE'::text END, - a.attnum, a.atttypid, a.attcollation - FROM pg_class c, pg_attribute a - WHERE c.oid = a.attrelid - AND c.relkind IN ('r', 'm', 'v', 'f', 'c') - AND (c.relname not like 'mlog_%' AND c.relname not like 'matviewmap_%') - AND attnum > 0 AND NOT attisdropped - - UNION ALL - - /* domains */ - SELECT t.typnamespace, CAST(t.typname AS sql_identifier), - 'DOMAIN'::text, 1, t.typbasetype, t.typcollation - FROM pg_type t - WHERE t.typtype = 'd' - - UNION ALL - - /* parameters */ - SELECT pronamespace, CAST(proname || '_' || CAST(oid AS text) AS sql_identifier), - 'ROUTINE'::text, (ss.x).n, (ss.x).x, 0 - FROM (SELECT p.pronamespace, p.proname, p.oid, - _pg_expandarray(coalesce(p.proallargtypes, p.proargtypes::oid[])) AS x - FROM pg_proc p) AS ss - - UNION ALL - - /* result types */ - SELECT p.pronamespace, CAST(p.proname || '_' || CAST(p.oid AS text) AS sql_identifier), - 'ROUTINE'::text, 0, p.prorettype, 0 - FROM pg_proc p - - ) AS x (objschema, objname, objtype, objdtdid, objtypeid, objcollation) - LEFT JOIN (pg_collation co JOIN pg_namespace nco ON (co.collnamespace = nco.oid)) - ON x.objcollation = co.oid AND (nco.nspname, co.collname) <> ('pg_catalog', 'default') - - WHERE n.oid = x.objschema - AND at.oid = x.objtypeid - AND (at.typelem <> 0 AND at.typlen = -1) - AND at.typelem = bt.oid - AND nbt.oid = bt.typnamespace - - AND (n.nspname, x.objname, x.objtype, CAST(x.objdtdid AS sql_identifier)) IN - ( SELECT object_schema, object_name, object_type, dtd_identifier - FROM data_type_privileges ); - -GRANT SELECT ON information_schema.element_types TO PUBLIC; -GRANT SELECT ON information_schema.data_type_privileges TO PUBLIC; -GRANT SELECT ON information_schema.role_column_grants TO PUBLIC; -GRANT SELECT ON information_schema.role_table_grants TO PUBLIC; -GRANT SELECT ON information_schema.column_domain_usage TO PUBLIC; -GRANT SELECT ON information_schema.column_privileges TO PUBLIC; -GRANT SELECT ON information_schema.column_udt_usage TO PUBLIC; -GRANT SELECT ON information_schema.columns TO PUBLIC; -GRANT SELECT ON information_schema.table_privileges TO PUBLIC; -GRANT SELECT ON information_schema.tables TO PUBLIC; -GRANT SELECT ON information_schema.view_column_usage TO PUBLIC; -GRANT SELECT ON information_schema.view_table_usage TO PUBLIC; - -RESET search_path; - -DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6322; -CREATE FUNCTION pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text, OUT decrypt_result_str text) RETURNS text LANGUAGE INTERNAL as 'gs_decrypt'; - -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6323; -CREATE FUNCTION pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text, OUT encrypt_result_str text) RETURNS text LANGUAGE INTERNAL as 'gs_encrypt'; -DROP FUNCTION IF EXISTS pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6322; -CREATE FUNCTION pg_catalog.gs_decrypt(IN decryptstr text, IN keystr text, IN type text, OUT decrypt_result_str text) RETURNS text LANGUAGE INTERNAL as 'gs_decrypt'; - -DROP FUNCTION IF EXISTS pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text,OUT decrypt_result_str text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 6323; -CREATE FUNCTION pg_catalog.gs_encrypt(IN encryptstr text, IN keystr text, IN type text, OUT encrypt_result_str text) RETURNS text LANGUAGE INTERNAL as 'gs_encrypt';UPDATE pg_catalog.pg_am set amcanunique = TRUE where amname = 'cbtree'; -CREATE OR REPLACE VIEW pg_catalog.gs_session_cpu_statistics AS -SELECT - S.datid AS datid, - S.usename, - S.pid, - S.query_start AS start_time, - T.min_cpu_time, - T.max_cpu_time, - T.total_cpu_time, - S.query, - S.node_group, - T.top_cpu_dn -FROM pg_stat_activity_ng AS S, pg_stat_get_wlm_realtime_session_info(NULL) AS T -WHERE S.sessionid = T.threadid; diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_425.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_425.sql deleted file mode 100644 index 495c2b9dd..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade-post_catalog_otherdb_92_425.sql +++ /dev/null @@ -1,148 +0,0 @@ --- adding system table pg_subscription - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, false, 6126, 6128, 0, 0; - -CREATE TABLE IF NOT EXISTS pg_catalog.pg_subscription -( - subdbid oid NOCOMPRESS NOT NULL, - subname name NOCOMPRESS, - subowner oid NOCOMPRESS, - subenabled bool NOCOMPRESS, - subconninfo text NOCOMPRESS, - subslotname name NOCOMPRESS, - subsynccommit bool NOCOMPRESS, - subpublications text[] NOCOMPRESS -) WITH OIDS TABLESPACE pg_global; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, false, 0, 0, 0, 6124; -CREATE UNIQUE INDEX pg_subscription_oid_index ON pg_catalog.pg_subscription USING BTREE(oid OID_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, false, 0, 0, 0, 6125; -CREATE UNIQUE INDEX pg_subscription_subname_index ON pg_catalog.pg_subscription USING BTREE(subdbid, subname); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0; - -GRANT SELECT ON TABLE pg_catalog.pg_subscription TO PUBLIC; - --- adding system table pg_replication_origin - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, false, 6134, 6143, 0, 0; - -CREATE TABLE IF NOT EXISTS pg_catalog.pg_replication_origin -( - roident oid NOCOMPRESS NOT NULL, - roname text NOCOMPRESS -) TABLESPACE pg_global; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, false, 0, 0, 0, 6136; -CREATE UNIQUE INDEX pg_replication_origin_roident_index ON pg_catalog.pg_replication_origin USING BTREE(roident OID_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, true, false, 0, 0, 0, 6137; -CREATE UNIQUE INDEX pg_replication_origin_roname_index ON pg_catalog.pg_replication_origin USING BTREE(roname TEXT_PATTERN_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0; - -GRANT SELECT ON TABLE pg_catalog.pg_replication_origin TO PUBLIC; - --- adding function pg_replication_origin_create -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_create(IN node_name text, OUT replication_origin_oid oid) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2635; -CREATE FUNCTION pg_catalog.pg_replication_origin_create(IN node_name text, OUT replication_origin_oid oid) RETURNS oid LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_create'; - --- adding function pg_replication_origin_drop -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_drop(IN node_name text, OUT replication_origin_oid oid) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2636; -CREATE FUNCTION pg_catalog.pg_replication_origin_drop(IN node_name text, OUT replication_origin_oid oid) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_drop'; - --- adding function pg_replication_origin_oid -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_oid(IN node_name text, OUT replication_origin_oid oid) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2637; -CREATE FUNCTION pg_catalog.pg_replication_origin_oid(IN node_name text, OUT replication_origin_oid oid) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_oid'; - --- adding function pg_replication_origin_session_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_setup(IN node_name text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2751; -CREATE FUNCTION pg_catalog.pg_replication_origin_session_setup(IN node_name text) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_session_setup'; - --- adding function pg_replication_origin_session_reset -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_reset() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2750; -CREATE FUNCTION pg_catalog.pg_replication_origin_session_reset() RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_session_reset'; - --- adding function pg_replication_origin_session_is_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_is_setup() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2639; -CREATE FUNCTION pg_catalog.pg_replication_origin_session_is_setup() RETURNS boolean LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_session_is_setup'; - --- adding function pg_replication_origin_session_progress -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_session_progress(IN flush boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2640; -CREATE FUNCTION pg_catalog.pg_replication_origin_session_progress(IN flush boolean) RETURNS record LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_session_progress'; - --- adding function pg_replication_origin_xact_setup -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_xact_setup(IN origin_lsn text, IN origin_timestamp timestamp with time zone) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2799; -CREATE FUNCTION pg_catalog.pg_replication_origin_xact_setup(IN origin_lsn text, IN origin_timestamp timestamp with time zone) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_xact_setup'; - --- adding function pg_replication_origin_xact_reset -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_xact_reset() CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2752; -CREATE FUNCTION pg_catalog.pg_replication_origin_xact_reset() RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_xact_reset'; - --- adding function pg_replication_origin_advance -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_advance(IN node_name text, IN lsn text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2634; -CREATE FUNCTION pg_catalog.pg_replication_origin_advance(IN node_name text, IN lsn text) RETURNS void LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_advance'; - --- adding function pg_replication_origin_progress -DROP FUNCTION IF EXISTS pg_catalog.pg_replication_origin_progress(IN node_name text, IN flush boolean) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2638; -CREATE FUNCTION pg_catalog.pg_replication_origin_progress(IN node_name text, IN flush boolean) RETURNS record LANGUAGE INTERNAL STRICT AS 'pg_replication_origin_progress'; - --- adding function pg_show_replication_origin_status -DROP FUNCTION IF EXISTS pg_catalog.pg_show_replication_origin_status(OUT local_id oid, OUT external_id text, OUT remote_lsn text, OUT local_lsn text) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2800; -CREATE FUNCTION pg_catalog.pg_show_replication_origin_status(OUT local_id oid, OUT external_id text, OUT remote_lsn text, OUT local_lsn text) RETURNS SETOF record LANGUAGE INTERNAL STABLE ROWS 100 AS 'pg_show_replication_origin_status'; - --- adding function pg_get_publication_tables -DROP FUNCTION IF EXISTS pg_catalog.pg_get_publication_tables(IN pubname text, OUT relid oid) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2801; -CREATE FUNCTION pg_catalog.pg_get_publication_tables(IN pubname text, OUT relid oid) RETURNS SETOF oid LANGUAGE INTERNAL STABLE STRICT AS 'pg_get_publication_tables'; - --- adding function pg_stat_get_subscription -DROP FUNCTION IF EXISTS pg_catalog.pg_stat_get_subscription(IN subid oid, OUT subid oid, OUT pid integer, OUT received_lsn text, OUT last_msg_send_time timestamp with time zone, OUT last_msg_receipt_time timestamp with time zone, OUT latest_end_lsn text, OUT latest_end_time timestamp with time zone) CASCADE; -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 2802; -CREATE FUNCTION pg_catalog.pg_stat_get_subscription(IN subid oid, OUT subid oid, OUT pid integer, OUT received_lsn text, OUT last_msg_send_time timestamp with time zone, OUT last_msg_receipt_time timestamp with time zone, OUT latest_end_lsn text, OUT latest_end_time timestamp with time zone) RETURNS record LANGUAGE INTERNAL STABLE AS 'pg_stat_get_subscription'; - --- adding system view -DROP VIEW IF EXISTS pg_catalog.pg_publication_tables CASCADE; -CREATE VIEW pg_catalog.pg_publication_tables AS - SELECT - P.pubname AS pubname, - N.nspname AS schemaname, - C.relname AS tablename - FROM pg_publication P, pg_class C - JOIN pg_namespace N ON (N.oid = C.relnamespace) - WHERE C.oid IN (SELECT relid FROM pg_get_publication_tables(P.pubname)); - -DROP VIEW IF EXISTS pg_catalog.pg_stat_subscription CASCADE; -CREATE VIEW pg_catalog.pg_stat_subscription AS - SELECT - su.oid AS subid, - su.subname, - st.pid, - st.received_lsn, - st.last_msg_send_time, - st.last_msg_receipt_time, - st.latest_end_lsn, - st.latest_end_time - FROM pg_subscription su - LEFT JOIN pg_stat_get_subscription(NULL) st - ON (st.subid = su.oid); - -DROP VIEW IF EXISTS pg_catalog.pg_replication_origin_status CASCADE; -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 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 d19a8f04b..ca079e608 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 @@ -4562,7 +4562,7 @@ CREATE TABLE IF NOT EXISTS pg_catalog.pg_subscription subenabled bool NOCOMPRESS, subconninfo text NOCOMPRESS, subslotname name NOCOMPRESS, - subsynccommit bool NOCOMPRESS, + subsynccommit text NOCOMPRESS, subpublications text[] NOCOMPRESS ) WITH OIDS TABLESPACE pg_global; diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_420.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_420.sql deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_421.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_421.sql deleted file mode 100644 index ee6088557..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_421.sql +++ /dev/null @@ -1,4 +0,0 @@ --- -------------------------------------------------------------- --- upgrade pg_catalog.pg_collation --- -------------------------------------------------------------- -insert into pg_catalog.pg_collation values ('zh_CN', 11, 10, 36, 'zh_CN.gb18030', 'zh_CN.gb18030'), ('zh_CN.gb18030', 11, 10, 36, 'zh_CN.gb18030', 'zh_CN.gb18030'); \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_422.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_422.sql deleted file mode 100644 index 5285b72f6..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_422.sql +++ /dev/null @@ -1,20 +0,0 @@ --- -------------------------------------------------------------- --- upgrade pg_catalog.pg_buffercache_pages --- -------------------------------------------------------------- -DROP FUNCTION IF EXISTS pg_catalog.pg_buffercache_pages() CASCADE; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4130; -CREATE OR REPLACE FUNCTION pg_catalog.pg_buffercache_pages -(out bufferid pg_catalog.int4, -out relfilenode pg_catalog.oid, -out bucketid pg_catalog.int4, -out storage_type pg_catalog.int2, -out reltablespace pg_catalog.oid, -out reldatabase pg_catalog.oid, -out relforknumber pg_catalog.int2, -out relblocknumber pg_catalog.int8, -out isdirty pg_catalog.bool, -out isvalid pg_catalog.bool, -out usage_count pg_catalog.int2, -out pinning_backends pg_catalog.int4) -RETURNS SETOF record LANGUAGE INTERNAL STABLE STRICT as 'pg_buffercache_pages'; \ No newline at end of file diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_424.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_424.sql deleted file mode 100644 index be265bf52..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_424.sql +++ /dev/null @@ -1,22 +0,0 @@ -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 4768; -CREATE OR REPLACE FUNCTION pg_catalog.gs_read_block_from_remote -( int4, - int4, - int4, - int2, - int2, - int4, - xid, - int4, - xid, - boolean) -RETURNS SETOF record LANGUAGE INTERNAL ROWS 1 STRICT as 'gs_read_block_from_remote_compress'; --- pg_read_binary_file_blocks() --- -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_PROC, 8413; -CREATE FUNCTION pg_catalog.pg_read_binary_file_blocks(IN inputpath text, IN startblocknum int8, IN count int8, - OUT path text, - OUT blocknum int4, - OUT len int4, - OUT data bytea) - AS 'pg_read_binary_file_blocks' LANGUAGE INTERNAL IMMUTABLE STRICT; diff --git a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_425.sql b/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_425.sql deleted file mode 100644 index e3ae049cd..000000000 --- a/src/include/catalog/upgrade_sql/upgrade_catalog_otherdb/upgrade_catalog_otherdb_92_425.sql +++ /dev/null @@ -1,43 +0,0 @@ --- adding system table pg_publication - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 6130, 6141, 0, 0; - -CREATE TABLE IF NOT EXISTS pg_catalog.pg_publication -( - pubname name NOCOMPRESS, - pubowner oid NOCOMPRESS, - puballtables bool NOCOMPRESS, - pubinsert bool NOCOMPRESS, - pubupdate bool NOCOMPRESS, - pubdelete bool NOCOMPRESS -) WITH OIDS; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 6120; -CREATE UNIQUE INDEX pg_publication_oid_index ON pg_catalog.pg_publication USING BTREE(oid OID_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 6121; -CREATE UNIQUE INDEX pg_publication_pubname_index ON pg_catalog.pg_publication USING BTREE(pubname); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0; - -GRANT SELECT ON TABLE pg_catalog.pg_publication TO PUBLIC; - --- adding system table pg_publication_rel - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 6132, 6142, 0, 0; - -CREATE TABLE IF NOT EXISTS pg_catalog.pg_publication_rel -( - prpubid oid NOCOMPRESS NOT NULL, - prrelid oid NOCOMPRESS NOT NULL -) WITH OIDS; - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 6122; -CREATE UNIQUE INDEX pg_publication_rel_oid_index ON pg_catalog.pg_publication_rel USING BTREE(oid OID_OPS); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 6123; -CREATE UNIQUE INDEX pg_publication_rel_map_index ON pg_catalog.pg_publication_rel USING BTREE(prrelid, prpubid); - -SET LOCAL inplace_upgrade_next_system_object_oids = IUO_CATALOG, false, true, 0, 0, 0, 0; - -GRANT SELECT ON TABLE pg_catalog.pg_publication_rel TO PUBLIC; \ No newline at end of file