Re: BUG #18764: server closed the connection unexpectedly - Mailing list pgsql-bugs

From Richard Guo
Subject Re: BUG #18764: server closed the connection unexpectedly
Date
Msg-id CAMbWs49c7-RbgZ-_6c4HTOS52LJjoGkkdCP7Q1E9yEq=tziR6w@mail.gmail.com
Whole thread Raw
In response to BUG #18764: server closed the connection unexpectedly  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
On Thu, Jan 9, 2025 at 12:44 PM David Rowley <dgrowleyml@gmail.com> wrote:
> On Tue, 7 Jan 2025 at 02:14, Richard Guo <guofenglinux@gmail.com> wrote:
> > --- a/src/backend/optimizer/plan/planner.c
> > +++ b/src/backend/optimizer/plan/planner.c
> > @@ -8091,6 +8091,9 @@ generate_setop_child_grouplist(SetOperationStmt
> > *op, List *targetlist)
> >     {
> >         TargetEntry *tle = (TargetEntry *) lfirst(lt);
> >         SortGroupClause *sgc;
> > +       Oid         opfamily,
> > +                   opcintype;
> > +       int16       strategy;
> >
> >         /* resjunk columns could have sortgrouprefs.  Leave these alone */
> >         if (tle->resjunk)
> > @@ -8101,6 +8104,18 @@ generate_setop_child_grouplist(SetOperationStmt
> > *op, List *targetlist)
> >         sgc = (SortGroupClause *) lfirst(lg);
> >         lg = lnext(grouplist, lg);
> >
> > +       if (!OidIsValid(sgc->sortop))
> > +           return NIL;
> > +
> > +       /* Find the operator in pg_amop --- failure shouldn't happen */
> > +       if (!get_ordering_op_properties(sgc->sortop,
> > +                                       &opfamily, &opcintype, &strategy))
> > +           elog(ERROR, "operator %u is not a valid ordering operator",
> > +                sgc->sortop);
> > +
> > +       if (exprType((Node *) tle->expr) != opcintype)
> > +           return NIL;
> > +
> >         /* assign a tleSortGroupRef, or reuse the existing one */
> >         sgc->tleSortGroupRef = assignSortGroupRef(tle, targetlist);
> >     }
>
> Can't you just look up the setop's type from op->colTypes instead of
> looking the type up via the sortop? i.e. the attached?

Yeah, right.  Using SetOperationStmt.colTypes is more convenient here.

Thanks
Richard



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18764: server closed the connection unexpectedly
Next
From: PG Bug reporting form
Date:
Subject: BUG #18769: ldapscheme is not displayed in pg_hba_file_rules