From: Pavan Deolasee Date: Wed, 29 Aug 2018 05:58:38 +0000 (+0530) Subject: Ensure pgxc_node_str returns the result in correct format X-Git-Tag: XL_10_R1BETA1~23 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=ade955d1a0aa824c6a55cb9dd3abafcac8712be3;p=postgres-xl.git Ensure pgxc_node_str returns the result in correct format Per report from Krzysztof Nienartowicz, this broke the pgxc_clean command on XL10. --- diff --git a/src/backend/pgxc/pool/pgxcnode.c b/src/backend/pgxc/pool/pgxcnode.c index f6dfd2a48c..01d678dd2f 100644 --- a/src/backend/pgxc/pool/pgxcnode.c +++ b/src/backend/pgxc/pool/pgxcnode.c @@ -2566,7 +2566,15 @@ PGXCNodeGetNodeOid(int nodeid, char node_type) Datum pgxc_node_str(PG_FUNCTION_ARGS) { - PG_RETURN_TEXT_P(cstring_to_text(PGXCNodeName)); + Name result; + int len; + + len = strlen(PGXCNodeName); + /* We use palloc0 here to ensure result is zero-padded */ + result = (Name) palloc0(NAMEDATALEN); + memcpy(NameStr(*result), PGXCNodeName, NAMEDATALEN - 1); + + PG_RETURN_NAME(result); } /*