pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Guo <guofenglinux@gmail.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: dqetool@126.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18764: server closed the connection unexpectedly
Date: Thu, 9 Jan 2025 16:38:09 +0900
Message-ID: <CAMbWs49c7-RbgZ-_6c4HTOS52LJjoGkkdCP7Q1E9yEq=tziR6w@mail.gmail.com> (raw)
In-Reply-To: <CAApHDvpytcc1eVXwB5brsjeppezvi4EJ_vTV+m3yUa2N-zT46A@mail.gmail.com>
References: <18764-63ad667ea26e877a@postgresql.org>
	<446342.1735923417@sss.pgh.pa.us>
	<468120.1735927103@sss.pgh.pa.us>
	<CAMbWs49+-TEOGJmkQVPrEj6eu43ND7GNqccd8OCXxuFQTga1qg@mail.gmail.com>
	<CAApHDvpytcc1eVXwB5brsjeppezvi4EJ_vTV+m3yUa2N-zT46A@mail.gmail.com>

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





view thread (12+ messages)  latest in thread

Message-ID: <CAMbWs49c7-RbgZ-_6c4HTOS52LJjoGkkdCP7Q1E9yEq=tziR6w@mail.gmail.com>
Permalink:  ../CAMbWs49c7-RbgZ-_6c4HTOS52LJjoGkkdCP7Q1E9yEq=tziR6w@mail.gmail.com/
Also on:    postgresql.org/message-id/CAMbWs49c7-RbgZ-_6c4HTOS52LJjoGkkdCP7Q1E9yEq=tziR6w@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: guofenglinux@gmail.com, dgrowleyml@gmail.com, tgl@sss.pgh.pa.us, dqetool@126.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18764: server closed the connection unexpectedly
  In-Reply-To: <CAMbWs49c7-RbgZ-_6c4HTOS52LJjoGkkdCP7Q1E9yEq=tziR6w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox