Re: Fix NULL pointer reference in _outPathTarget()

Peter Eisentraut <peter.eisentraut@enterprisedb.com>

From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Richard Guo <guofenglinux@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2022-04-20T16:04:00Z
Lists: pgsql-hackers
On 18.04.22 20:53, Tom Lane wrote:
> A semantics-preserving conversion would have looked something like
> 
>      if (node->sortgrouprefs)
>          WRITE_INDEX_ARRAY(sortgrouprefs, list_length(node->exprs));
> 
> I suppose that Peter was trying to remove special cases from the
> outfuncs.c code, but do we want to put this one back?  Richard's
> proposal would not accurately reflect the contents of the data
> structure, so I'm not too thrilled with it.

I think we could put the if (node->fldname) inside the WRITE_INDEX_ARRAY 
macro.



Commits

  1. Handle NULL fields in WRITE_INDEX_ARRAY