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

Commit9ddf251

Browse files
committed
Handle NULL fields in WRITE_INDEX_ARRAY
Unlike existing WRITE_*_ARRAY macros, WRITE_INDEX_ARRAY needs tohandle the case that the field is NULL. We already have theconvention to print NULL fields as "<>", so we do that here as well.There is currently no corresponding read function for this, so readingthis back in is not implemented, but it could be if needed.Reported-by: Richard Guo <guofenglinux@gmail.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://www.postgresql.org/message-id/flat/CAMbWs4-LN%3DbF8f9eU2R94dJtF54DfDvBq%2BovqHnOQqbinYDrUw%40mail.gmail.com
1 parent06cafd6 commit9ddf251

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎src/backend/nodes/outfuncs.c

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

127+
/*
128+
* This macro supports the case that the field is NULL. For the other array
129+
* macros, that is currently not needed.
130+
*/
127131
#defineWRITE_INDEX_ARRAY(fldname,len) \
128132
do { \
129133
appendStringInfoString(str, " :" CppAsString(fldname) " "); \
130-
for (int i = 0; i < len; i++) \
131-
appendStringInfo(str, " %u", node->fldname[i]); \
134+
if (node->fldname) \
135+
for (int i = 0; i < len; i++) \
136+
appendStringInfo(str, " %u", node->fldname[i]); \
137+
else \
138+
appendStringInfoString(str, "<>"); \
132139
} while(0)
133140

134141
#defineWRITE_INT_ARRAY(fldname,len) \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp