aboutsummaryrefslogtreecommitdiff
path: root/src/backend/tcop/postgres.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-07-20 13:04:33 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-07-20 13:04:33 -0400
commit2d04277121f2f8e18b65190f0dfa8ca97e9c29cb (patch)
tree7e71eab88b213e02699d836ece9adadbcbb81896 /src/backend/tcop/postgres.c
parentf77ff083350eb5a2625a4dbfca61d15b66c4918b (diff)
downloadpostgresql-2d04277121f2f8e18b65190f0dfa8ca97e9c29cb.tar.gz
postgresql-2d04277121f2f8e18b65190f0dfa8ca97e9c29cb.zip
Make serialization of Nodes' scalar-array fields more robust.
When the ability to print variable-length-array fields was first added to outfuncs.c, there was no corresponding read capability, as it was used only for debug dumps of planner-internal Nodes. Not a lot of thought seems to have been put into the output format: it's just the space-separated array elements and nothing else. Later such fields appeared in Plan nodes, and still later we grew read support so that Plans could be transferred to parallel workers, but the original text format wasn't rethought. It seems inadequate to me because (a) no cross-check is possible that we got the right number of array entries, (b) we can't tell the difference between a NULL pointer and a zero-length array, and (c) except for WRITE_INDEX_ARRAY, we'd crash if a non-zero length is specified when the pointer is NULL, a situation that can arise in some fields that we currently conveniently avoid printing. Since we're currently in a campaign to make the Node infrastructure generally more it-just-works-without-thinking-about-it, now seems like a good time to improve this. Let's adopt a format similar to that used for Lists, that is "<>" for a NULL pointer or "(item item item)" otherwise. Also retool the code to not have so many copies of the identical logic. I bumped catversion out of an abundance of caution, although I think that we don't use any such array fields in Nodes that can get into the catalogs. Discussion: https://postgr.es/m/1528424.1658272135@sss.pgh.pa.us
Diffstat (limited to 'src/backend/tcop/postgres.c')
0 files changed, 0 insertions, 0 deletions