Re: Fix NULL pointer reference in _outPathTarget()

2022-04-27 Thread Peter Eisentraut
On 22.04.22 16:18, Tom Lane wrote: Peter Eisentraut writes: On 20.04.22 18:53, Tom Lane wrote: Yeah, that's another way to do it. I think though that the unresolved question is whether or not we want the field name to appear in the output when the field is null. I believe that I intentionall

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-22 Thread Tom Lane
Peter Eisentraut writes: > On 20.04.22 18:53, Tom Lane wrote: >> Yeah, that's another way to do it. I think though that the unresolved >> question is whether or not we want the field name to appear in the output >> when the field is null. I believe that I intentionally made it not appear >> orig

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-22 Thread Peter Eisentraut
On 20.04.22 18:53, Tom Lane wrote: I think we could put the if (node->fldname) inside the WRITE_INDEX_ARRAY macro. Yeah, that's another way to do it. I think though that the unresolved question is whether or not we want the field name to appear in the output when the field is null. I believ

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-20 Thread Richard Guo
On Thu, Apr 21, 2022 at 12:02 AM Peter Eisentraut < peter.eisentr...@enterprisedb.com> wrote: > On 18.04.22 09:35, Richard Guo wrote: > > The array sortgrouprefs[] inside PathTarget might be NULL if we have not > > identified sort/group columns in this tlist. In that case we would have > > a NULL

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-20 Thread Tom Lane
Peter Eisentraut writes: > 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 think we could put the if (node->fldname) inside the

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-20 Thread Peter Eisentraut
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 wa

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-20 Thread Peter Eisentraut
On 18.04.22 09:35, Richard Guo wrote: The array sortgrouprefs[] inside PathTarget might be NULL if we have not identified sort/group columns in this tlist. In that case we would have a NULL pointer reference in _outPathTarget() when trying to print sortgrouprefs[] with WRITE_INDEX_ARRAY as we are

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-19 Thread Alvaro Herrera
On 2022-Apr-18, Tom Lane wrote: > 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. Yeah -- looking at t

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-18 Thread Richard Guo
On Tue, Apr 19, 2022 at 2:53 AM 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 > outf

Re: Fix NULL pointer reference in _outPathTarget()

2022-04-18 Thread Tom Lane
Richard Guo writes: > The array sortgrouprefs[] inside PathTarget might be NULL if we have not > identified sort/group columns in this tlist. In that case we would have > a NULL pointer reference in _outPathTarget() when trying to print > sortgrouprefs[] with WRITE_INDEX_ARRAY as we are using the

Fix NULL pointer reference in _outPathTarget()

2022-04-18 Thread Richard Guo
The array sortgrouprefs[] inside PathTarget might be NULL if we have not identified sort/group columns in this tlist. In that case we would have a NULL pointer reference in _outPathTarget() when trying to print sortgrouprefs[] with WRITE_INDEX_ARRAY as we are using the length of PathTarget->exprs a