Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbdeb2c4

Browse files
committed
Add WRITE_INDEX_ARRAY
We have a few WRITE_{name of type}_ARRAY macros, but the one caseusing the Index type was hand-coded. Wrap it into a macro as well.This also changes the behavior slightly: Before, the field name wasskipped if the length was zero. Now it prints the field name even inthat case. This is more consistent with how other array fields arehandled.Reviewed-by: Jacob Champion <pchampion@vmware.com>Discussion:https://www.postgresql.org/message-id/c091e5cd-45f8-69ee-6a9b-de86912cc7e7@enterprisedb.com
1 parent308da17 commitbdeb2c4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/backend/nodes/outfuncs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ static void outChar(StringInfo str, char c);
124124
appendStringInfo(str, " %u", node->fldname[i]); \
125125
} while(0)
126126

127+
#defineWRITE_INDEX_ARRAY(fldname,len) \
128+
do { \
129+
appendStringInfoString(str, " :" CppAsString(fldname) " "); \
130+
for (int i = 0; i < len; i++) \
131+
appendStringInfo(str, " %u", node->fldname[i]); \
132+
} while(0)
133+
127134
#defineWRITE_INT_ARRAY(fldname,len) \
128135
do { \
129136
appendStringInfoString(str, " :" CppAsString(fldname) " "); \
@@ -2510,14 +2517,7 @@ _outPathTarget(StringInfo str, const PathTarget *node)
25102517
WRITE_NODE_TYPE("PATHTARGET");
25112518

25122519
WRITE_NODE_FIELD(exprs);
2513-
if (node->sortgrouprefs)
2514-
{
2515-
inti;
2516-
2517-
appendStringInfoString(str," :sortgrouprefs");
2518-
for (i=0;i<list_length(node->exprs);i++)
2519-
appendStringInfo(str," %u",node->sortgrouprefs[i]);
2520-
}
2520+
WRITE_INDEX_ARRAY(sortgrouprefs,list_length(node->exprs));
25212521
WRITE_FLOAT_FIELD(cost.startup,"%.2f");
25222522
WRITE_FLOAT_FIELD(cost.per_tuple,"%.2f");
25232523
WRITE_INT_FIELD(width);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp