Implement onurctirtir's suggestions

pull/7720/head
German Eichberger 2025-03-12 21:37:18 +00:00
parent 09ab4bdcb3
commit 7aa3e93852
4 changed files with 16 additions and 7 deletions

View File

@ -1681,12 +1681,12 @@ citus_is_primary_node(PG_FUNCTION_ARGS)
if (workerNode == NULL)
{
ereport(WARNING, (errmsg("could not find the current node in pg_dist_node"),
errdetail("If this is the coordinator node, consider adding it "
"into the metadata by using citus_set_coordinator_host() "
"UDF. Otherwise, if you're going to use this node as a "
"worker node for a new cluster, make sure to add this "
"node into the metadata from the coordinator by using "
"citus_add_node() UDF."));
errdetail("If this is the coordinator node, consider adding it "
"into the metadata by using citus_set_coordinator_host() "
"UDF. Otherwise, if you're going to use this node as a "
"worker node for a new cluster, make sure to add this "
"node into the metadata from the coordinator by using "
"citus_add_node() UDF.")));
PG_RETURN_NULL();
}

View File

@ -55,3 +55,4 @@ DROP VIEW IF EXISTS pg_catalog.citus_lock_waits;
#include "udfs/citus_internal_update_relation_colocation/12.2-1.sql"
#include "udfs/repl_origin_helper/12.2-1.sql"
#include "udfs/citus_finish_pg_upgrade/12.2-1.sql"
#include "udfs/citus_is_primary_node/12.2-1.sql"

View File

@ -26,6 +26,7 @@ DROP FUNCTION citus_internal.commit_management_command_2pc();
ALTER TABLE pg_catalog.pg_dist_transaction DROP COLUMN outer_xid;
REVOKE USAGE ON SCHEMA citus_internal FROM PUBLIC;
DROP FUNCTION pg_catalog.citus_is_primary_node();
DROP FUNCTION citus_internal.add_colocation_metadata(int, int, int, regtype, oid);
DROP FUNCTION citus_internal.add_object_metadata(text, text[], text[], integer, integer, boolean);
DROP FUNCTION citus_internal.add_partition_metadata(regclass, "char", text, integer, "char");
@ -53,5 +54,5 @@ DROP FUNCTION citus_internal.update_placement_metadata(bigint, integer, integer)
DROP FUNCTION citus_internal.update_relation_colocation(oid, int);
DROP FUNCTION citus_internal.start_replication_origin_tracking();
DROP FUNCTION citus_internal.stop_replication_origin_tracking();
DROP FUNCTION citus_internal.is_replication_origin_tracking_active();
DROP FUNCTION citus_internal.is_replication_origin_tracking_active();
#include "../udfs/citus_finish_pg_upgrade/12.1-1.sql"

View File

@ -0,0 +1,7 @@
CREATE FUNCTION pg_catalog.citus_is_primary_node()
RETURNS bool
LANGUAGE c
STRICT
AS 'MODULE_PATHNAME', $$citus_is_primary_node$$;
COMMENT ON FUNCTION pg_catalog.citus_is_primary_node()
IS 'returns whether the current node is the primary node in the group';