From 6fc48134292d1ce699143f7d3d2e81c5aed3b7bd Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" Date: Mon, 25 Aug 2025 08:42:03 +0800 Subject: [PATCH v1] Fixes a trivial bug in dumped parse/query/plan trees This patch fixes a trivial bug where an extra whitespace was added when dumping an array, for example: ``` :sort.numCols 2 :sort.sortColIdx ( 1 4) :sort.sortOperators ( 97 1754) :sort.collations ( 0 0) :sort.nullsFirst ( false false) ``` The unnecessary whitespace is now removed. Author: Li Chao --- src/backend/nodes/outfuncs.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index eaf391fc2ab..be390d42723 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -238,18 +238,22 @@ fnname(StringInfo str, const datatype *arr, int len) \ { \ appendStringInfoChar(str, '('); \ for (int i = 0; i < len; i++) \ + { \ appendStringInfo(str, fmtstr, convfunc(arr[i])); \ + if (i < len - 1) \ + appendStringInfoChar(str, ' '); \ + } \ appendStringInfoChar(str, ')'); \ } \ else \ appendStringInfoString(str, "<>"); \ } -WRITE_SCALAR_ARRAY(writeAttrNumberCols, AttrNumber, " %d",) -WRITE_SCALAR_ARRAY(writeOidCols, Oid, " %u",) -WRITE_SCALAR_ARRAY(writeIndexCols, Index, " %u",) -WRITE_SCALAR_ARRAY(writeIntCols, int, " %d",) -WRITE_SCALAR_ARRAY(writeBoolCols, bool, " %s", booltostr) +WRITE_SCALAR_ARRAY(writeAttrNumberCols, AttrNumber, "%d",) +WRITE_SCALAR_ARRAY(writeOidCols, Oid, "%u",) +WRITE_SCALAR_ARRAY(writeIndexCols, Index, "%u",) +WRITE_SCALAR_ARRAY(writeIntCols, int, "%d",) +WRITE_SCALAR_ARRAY(writeBoolCols, bool, "%s", booltostr) /* * Print an array (not a List) of Node pointers. -- 2.39.5 (Apple Git-154)