-- In PG17, Auto-generated array types, multirange types, and relation rowtypes
-- are treated as dependent objects, hence changing the output of the
-- print_extension_changes function.
-- Relevant PG commit: e5bc9454e527b1cba97553531d8d4992892fdeef
-- Here we create a table with only the basic extension types
-- in order to avoid printing extra ones for now
-- This can be removed when we drop PG16 support.
CREATE TABLE extension_basic_types (description text);
INSERT INTO extension_basic_types VALUES ('type citus.distribution_type'),
                                         ('type citus.shard_transfer_mode'),
                                         ('type citus_copy_format'),
                                         ('type noderole'),
                                         ('type citus_job_status'),
                                         ('type citus_task_status'),
                                         ('type replication_slot_info'),
                                         ('type split_copy_info'),
                                         ('type split_shard_info'),
                                         ('type cluster_clock');
-- list all postgres objects belonging to the citus extension
SELECT pg_catalog.pg_describe_object(classid, objid, 0) AS description
FROM pg_catalog.pg_depend, pg_catalog.pg_extension e
WHERE refclassid = 'pg_catalog.pg_extension'::pg_catalog.regclass
  AND refobjid = e.oid
  AND deptype = 'e'
  AND e.extname='citus'
  AND (pg_catalog.pg_describe_object(classid, objid, 0) NOT LIKE 'type%'
       OR
       pg_catalog.pg_describe_object(classid, objid, 0) IN (SELECT * FROM extension_basic_types))
  AND pg_catalog.pg_describe_object(classid, objid, 0) != 'function any_value(anyelement)'
  AND pg_catalog.pg_describe_object(classid, objid, 0) != 'function any_value_agg(anyelement,anyelement)'
ORDER BY 1;
                                                       description
---------------------------------------------------------------------
 event trigger citus_cascade_to_partition
 function alter_distributed_table(regclass,text,integer,text,boolean)
 function alter_old_partitions_set_access_method(regclass,timestamp with time zone,name)
 function alter_role_if_exists(text,text)
 function alter_table_set_access_method(regclass,text)
 function array_cat_agg(anycompatiblearray)
 function assign_distributed_transaction_id(integer,bigint,timestamp with time zone)
 function authinfo_valid(text)
 function broadcast_intermediate_result(text,text)
 function check_distributed_deadlocks()
 function citus_activate_node(text,integer)
 function citus_add_inactive_node(text,integer,integer,noderole,name)
 function citus_add_local_table_to_metadata(regclass,boolean)
 function citus_add_node(text,integer,integer,noderole,name)
 function citus_add_rebalance_strategy(name,regproc,regproc,regproc,real,real,real)
 function citus_add_secondary_node(text,integer,text,integer,name)
 function citus_backend_gpid()
 function citus_blocking_pids(integer)
 function citus_calculate_gpid(integer,integer)
 function citus_check_cluster_node_health()
 function citus_check_connection_to_node(text,integer)
 function citus_cleanup_orphaned_resources()
 function citus_cleanup_orphaned_shards()
 function citus_conninfo_cache_invalidate()
 function citus_coordinator_nodeid()
 function citus_copy_shard_placement(bigint,integer,integer,citus.shard_transfer_mode)
 function citus_copy_shard_placement(bigint,text,integer,text,integer,citus.shard_transfer_mode)
 function citus_create_restore_point(text)
 function citus_disable_node(text,integer,boolean)
 function citus_dist_local_group_cache_invalidate()
 function citus_dist_node_cache_invalidate()
 function citus_dist_object_cache_invalidate()
 function citus_dist_partition_cache_invalidate()
 function citus_dist_placement_cache_invalidate()
 function citus_dist_shard_cache_invalidate()
 function citus_drain_node(text,integer,citus.shard_transfer_mode,name)
 function citus_drop_all_shards(regclass,text,text,boolean)
 function citus_drop_trigger()
 function citus_executor_name(integer)
 function citus_extradata_container(internal)
 function citus_finalize_upgrade_to_citus11(boolean)
 function citus_finish_citus_upgrade()
 function citus_finish_pg_upgrade()
 function citus_get_active_worker_nodes()
 function citus_get_node_clock()
 function citus_get_transaction_clock()
 function citus_internal.find_groupid_for_node(text,integer)
 function citus_internal.pg_dist_node_trigger_func()
 function citus_internal.pg_dist_rebalance_strategy_trigger_func()
 function citus_internal.pg_dist_shard_placement_trigger_func()
 function citus_internal.refresh_isolation_tester_prepared_statement()
 function citus_internal.replace_isolation_tester_func()
 function citus_internal.restore_isolation_tester_func()
 function citus_internal_add_colocation_metadata(integer,integer,integer,regtype,oid)
 function citus_internal_add_object_metadata(text,text[],text[],integer,integer,boolean)
 function citus_internal_add_partition_metadata(regclass,"char",text,integer,"char")
 function citus_internal_add_placement_metadata(bigint,bigint,integer,bigint)
 function citus_internal_add_placement_metadata(bigint,integer,bigint,integer,bigint)
 function citus_internal_add_shard_metadata(regclass,bigint,"char",text,text)
 function citus_internal_add_tenant_schema(oid,integer)
 function citus_internal_adjust_local_clock_to_remote(cluster_clock)
 function citus_internal_delete_colocation_metadata(integer)
 function citus_internal_delete_partition_metadata(regclass)
 function citus_internal_delete_placement_metadata(bigint)
 function citus_internal_delete_shard_metadata(bigint)
 function citus_internal_delete_tenant_schema(oid)
 function citus_internal_global_blocked_processes()
 function citus_internal_is_replication_origin_tracking_active()
 function citus_internal_local_blocked_processes()
 function citus_internal_mark_node_not_synced(integer,integer)
 function citus_internal_start_replication_origin_tracking()
 function citus_internal_stop_replication_origin_tracking()
 function citus_internal_unregister_tenant_schema_globally(oid,text)
 function citus_internal_update_none_dist_table_metadata(oid,"char",bigint,boolean)
 function citus_internal_update_placement_metadata(bigint,integer,integer)
 function citus_internal_update_relation_colocation(oid,integer)
 function citus_is_clock_after(cluster_clock,cluster_clock)
 function citus_is_coordinator()
 function citus_isolation_test_session_is_blocked(integer,integer[])
 function citus_job_cancel(bigint)
 function citus_job_list()
 function citus_job_status(bigint,boolean)
 function citus_job_wait(bigint,citus_job_status)
 function citus_json_concatenate(json,json)
 function citus_json_concatenate_final(json)
 function citus_jsonb_concatenate(jsonb,jsonb)
 function citus_jsonb_concatenate_final(jsonb)
 function citus_local_disk_space_stats()
 function citus_locks()
 function citus_move_shard_placement(bigint,integer,integer,citus.shard_transfer_mode)
 function citus_move_shard_placement(bigint,text,integer,text,integer,citus.shard_transfer_mode)
 function citus_node_capacity_1(integer)
 function citus_nodeid_for_gpid(bigint)
 function citus_nodename_for_nodeid(integer)
 function citus_nodeport_for_nodeid(integer)
 function citus_pause_node_within_txn(integer,boolean,integer)
 function citus_pid_for_gpid(bigint)
 function citus_prepare_pg_upgrade()
 function citus_query_stats()
 function citus_rebalance_start(name,boolean,citus.shard_transfer_mode)
 function citus_rebalance_status(boolean)
 function citus_rebalance_stop()
 function citus_rebalance_wait()
 function citus_relation_size(regclass)
 function citus_remote_connection_stats()
 function citus_remove_node(text,integer)
 function citus_run_local_command(text)
 function citus_schema_distribute(regnamespace)
 function citus_schema_move(regnamespace,integer,citus.shard_transfer_mode)
 function citus_schema_move(regnamespace,text,integer,citus.shard_transfer_mode)
 function citus_schema_undistribute(regnamespace)
 function citus_server_id()
 function citus_set_coordinator_host(text,integer,noderole,name)
 function citus_set_default_rebalance_strategy(text)
 function citus_set_node_property(text,integer,text,boolean)
 function citus_shard_allowed_on_node_true(bigint,integer)
 function citus_shard_cost_1(bigint)
 function citus_shard_cost_by_disk_size(bigint)
 function citus_shard_indexes_on_worker()
 function citus_shard_sizes()
 function citus_shards_on_worker()
 function citus_split_shard_by_split_points(bigint,text[],integer[],citus.shard_transfer_mode)
 function citus_stat_activity()
 function citus_stat_statements()
 function citus_stat_statements_reset()
 function citus_stat_tenants(boolean)
 function citus_stat_tenants_local(boolean)
 function citus_stat_tenants_local_internal(boolean)
 function citus_stat_tenants_local_reset()
 function citus_stat_tenants_reset()
 function citus_table_is_visible(oid)
 function citus_table_size(regclass)
 function citus_task_wait(bigint,citus_task_status)
 function citus_text_send_as_jsonb(text)
 function citus_total_relation_size(regclass,boolean)
 function citus_truncate_trigger()
 function citus_unmark_object_distributed(oid,oid,integer)
 function citus_update_node(integer,text,integer,boolean,integer)
 function citus_update_shard_statistics(bigint)
 function citus_update_table_statistics(regclass)
 function citus_validate_rebalance_strategy_functions(regproc,regproc,regproc)
 function citus_version()
 function cluster_clock_cmp(cluster_clock,cluster_clock)
 function cluster_clock_eq(cluster_clock,cluster_clock)
 function cluster_clock_ge(cluster_clock,cluster_clock)
 function cluster_clock_gt(cluster_clock,cluster_clock)
 function cluster_clock_in(cstring)
 function cluster_clock_le(cluster_clock,cluster_clock)
 function cluster_clock_logical(cluster_clock)
 function cluster_clock_lt(cluster_clock,cluster_clock)
 function cluster_clock_ne(cluster_clock,cluster_clock)
 function cluster_clock_out(cluster_clock)
 function cluster_clock_recv(internal)
 function cluster_clock_send(cluster_clock)
 function column_name_to_column(regclass,text)
 function column_to_column_name(regclass,text)
 function coord_combine_agg(oid,cstring,anyelement)
 function coord_combine_agg_ffunc(internal,oid,cstring,anyelement)
 function coord_combine_agg_sfunc(internal,oid,cstring,anyelement)
 function create_distributed_function(regprocedure,text,text,boolean)
 function create_distributed_table(regclass,text,citus.distribution_type,text,integer)
 function create_distributed_table_concurrently(regclass,text,citus.distribution_type,text,integer)
 function create_intermediate_result(text,text)
 function create_reference_table(regclass)
 function create_time_partitions(regclass,interval,timestamp with time zone,timestamp with time zone)
 function distributed_tables_colocated(regclass,regclass)
 function drop_old_time_partitions(regclass,timestamp with time zone)
 function dump_global_wait_edges()
 function dump_local_wait_edges()
 function fetch_intermediate_results(text[],text,integer)
 function fix_all_partition_shard_index_names()
 function fix_partition_shard_index_names(regclass)
 function fix_pre_citus10_partitioned_table_constraint_names()
 function fix_pre_citus10_partitioned_table_constraint_names(regclass)
 function get_all_active_transactions()
 function get_colocated_shard_array(bigint)
 function get_colocated_table_array(regclass)
 function get_current_transaction_id()
 function get_global_active_transactions()
 function get_missing_time_partition_ranges(regclass,interval,timestamp with time zone,timestamp with time zone)
 function get_nodeid_for_groupid(integer)
 function get_rebalance_progress()
 function get_rebalance_table_shards_plan(regclass,real,integer,bigint[],boolean,name,real)
 function get_shard_id_for_distribution_column(regclass,"any")
 function isolate_tenant_to_new_shard(regclass,"any",text,citus.shard_transfer_mode)
 function json_cat_agg(json)
 function jsonb_cat_agg(jsonb)
 function lock_relation_if_exists(text,text)
 function lock_shard_metadata(integer,bigint[])
 function lock_shard_resources(integer,bigint[])
 function master_activate_node(text,integer)
 function master_add_inactive_node(text,integer,integer,noderole,name)
 function master_add_node(text,integer,integer,noderole,name)
 function master_add_secondary_node(text,integer,text,integer,name)
 function master_copy_shard_placement(bigint,text,integer,text,integer,boolean,citus.shard_transfer_mode)
 function master_create_empty_shard(text)
 function master_disable_node(text,integer)
 function master_drain_node(text,integer,citus.shard_transfer_mode,name)
 function master_get_active_worker_nodes()
 function master_get_new_placementid()
 function master_get_new_shardid()
 function master_get_table_ddl_events(text)
 function master_move_shard_placement(bigint,text,integer,text,integer,citus.shard_transfer_mode)
 function master_remove_distributed_table_metadata_from_workers(regclass,text,text)
 function master_remove_node(text,integer)
 function master_remove_partition_metadata(regclass,text,text)
 function master_run_on_worker(text[],integer[],text[],boolean)
 function master_set_node_property(text,integer,text,boolean)
 function master_unmark_object_distributed(oid,oid,integer)
 function master_update_node(integer,text,integer,boolean,integer)
 function master_update_shard_statistics(bigint)
 function master_update_table_statistics(regclass)
 function notify_constraint_dropped()
 function pg_cancel_backend(bigint)
 function pg_terminate_backend(bigint,bigint)
 function poolinfo_valid(text)
 function read_intermediate_result(text,citus_copy_format)
 function read_intermediate_results(text[],citus_copy_format)
 function rebalance_table_shards(regclass,real,integer,bigint[],citus.shard_transfer_mode,boolean,name)
 function recover_prepared_transactions()
 function relation_is_a_known_shard(regclass)
 function remove_local_tables_from_metadata()
 function replicate_reference_tables(citus.shard_transfer_mode)
 function replicate_table_shards(regclass,integer,integer,bigint[],citus.shard_transfer_mode)
 function role_exists(name)
 function run_command_on_all_nodes(text,boolean,boolean)
 function run_command_on_colocated_placements(regclass,regclass,text,boolean)
 function run_command_on_coordinator(text,boolean)
 function run_command_on_placements(regclass,text,boolean)
 function run_command_on_shards(regclass,text,boolean)
 function run_command_on_workers(text,boolean)
 function shard_name(regclass,bigint)
 function start_metadata_sync_to_all_nodes()
 function start_metadata_sync_to_node(text,integer)
 function stop_metadata_sync_to_node(text,integer,boolean)
 function time_partition_range(regclass)
 function truncate_local_data_after_distributing_table(regclass)
 function undistribute_table(regclass,boolean)
 function update_distributed_table_colocation(regclass,text)
 function worker_adjust_identity_column_seq_ranges(regclass)
 function worker_apply_inter_shard_ddl_command(bigint,text,bigint,text,text)
 function worker_apply_sequence_command(text)
 function worker_apply_sequence_command(text,regtype)
 function worker_apply_shard_ddl_command(bigint,text)
 function worker_apply_shard_ddl_command(bigint,text,text)
 function worker_change_sequence_dependency(regclass,regclass,regclass)
 function worker_copy_table_to_node(regclass,integer)
 function worker_create_or_alter_role(text,text,text)
 function worker_create_or_replace_object(text)
 function worker_create_or_replace_object(text[])
 function worker_create_truncate_trigger(regclass)
 function worker_drop_all_shell_tables(boolean)
 function worker_drop_distributed_table(text)
 function worker_drop_sequence_dependency(text)
 function worker_drop_shell_table(text)
 function worker_fix_partition_shard_index_names(regclass,text,text)
 function worker_fix_pre_citus10_partitioned_table_constraint_names(regclass,bigint,text)
 function worker_hash("any")
 function worker_last_saved_explain_analyze()
 function worker_nextval(regclass)
 function worker_partial_agg(oid,anyelement)
 function worker_partial_agg_ffunc(internal)
 function worker_partial_agg_sfunc(internal,oid,anyelement)
 function worker_partition_query_result(text,text,integer,citus.distribution_type,text[],text[],boolean,boolean,boolean)
 function worker_partitioned_relation_size(regclass)
 function worker_partitioned_relation_total_size(regclass)
 function worker_partitioned_table_size(regclass)
 function worker_record_sequence_dependency(regclass,regclass,name)
 function worker_save_query_explain_analyze(text,jsonb)
 function worker_split_copy(bigint,text,split_copy_info[])
 function worker_split_shard_release_dsm()
 function worker_split_shard_replication_setup(split_shard_info[],bigint)
 operator <(cluster_clock,cluster_clock)
 operator <=(cluster_clock,cluster_clock)
 operator <>(cluster_clock,cluster_clock)
 operator =(cluster_clock,cluster_clock)
 operator >(cluster_clock,cluster_clock)
 operator >=(cluster_clock,cluster_clock)
 operator class cluster_clock_ops for access method btree
 operator family cluster_clock_ops for access method btree
 schema citus
 schema citus_internal
 sequence pg_dist_background_job_job_id_seq
 sequence pg_dist_background_task_task_id_seq
 sequence pg_dist_cleanup_recordid_seq
 sequence pg_dist_clock_logical_seq
 sequence pg_dist_colocationid_seq
 sequence pg_dist_groupid_seq
 sequence pg_dist_node_nodeid_seq
 sequence pg_dist_operationid_seq
 sequence pg_dist_placement_placementid_seq
 sequence pg_dist_shardid_seq
 table pg_dist_authinfo
 table pg_dist_background_job
 table pg_dist_background_task
 table pg_dist_background_task_depend
 table pg_dist_cleanup
 table pg_dist_colocation
 table pg_dist_local_group
 table pg_dist_node
 table pg_dist_node_metadata
 table pg_dist_object
 table pg_dist_partition
 table pg_dist_placement
 table pg_dist_poolinfo
 table pg_dist_rebalance_strategy
 table pg_dist_schema
 table pg_dist_shard
 table pg_dist_transaction
 type citus.distribution_type
 type citus.shard_transfer_mode
 type citus_copy_format
 type citus_job_status
 type citus_task_status
 type cluster_clock
 type noderole
 type replication_slot_info
 type split_copy_info
 type split_shard_info
 view citus_dist_stat_activity
 view citus_lock_waits
 view citus_locks
 view citus_schema.citus_schemas
 view citus_schema.citus_tables
 view citus_shard_indexes_on_worker
 view citus_shards
 view citus_shards_on_worker
 view citus_stat_activity
 view citus_stat_statements
 view citus_stat_tenants
 view citus_stat_tenants_local
 view pg_dist_shard_placement
 view time_partitions
(333 rows)

DROP TABLE extension_basic_types;
