pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>
Cc: dqetool@126.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18764: server closed the connection unexpectedly
Date: Wed, 08 Jan 2025 22:57:44 -0500
Message-ID: <1793867.1736395064@sss.pgh.pa.us> (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>

David Rowley <dgrowleyml@gmail.com> writes:
> On Tue, 7 Jan 2025 at 02:14, Richard Guo <guofenglinux@gmail.com> wrote:
>> I've reached the same conclusion.  I'm thinking about whether we
>> should refrain from pushing pathkeys into the subplan when type
>> conversion occurs at the set-operation level.  Maybe we can do this
>> check in generate_setop_child_grouplist, like below.

> So I guess this must mean that we cannot assume that it's ever safe to
> assume that a type that is implicitly castable to the top setop's type
> sort order matches, so we must ensure we don't generate any
> setop_pathkeys for the subquery in this case.

The mere fact that there's an implicit cast sure doesn't make it safe.
We have implicit casts that cross sort-order behaviors (such as
integer to oid), and those would be just as big a hazard as this
example where the datatypes aren't physically compatible.

We could imagine detecting whether the subquery's datatype belongs
to the same btree opfamily as the outer query is using, and if so
adapting the pathkeys to that type.  But I'm dubious that it's
worth the trouble: if this were a common case we'd have discovered
this bug sooner.  So I'm for just not pushing down the pathkeys if
there's a type mismatch.

Didn't study the code, so have no opinion right now on the details
of how to check that.

			regards, tom lane





view thread (12+ messages)  latest in thread

Message-ID: <1793867.1736395064@sss.pgh.pa.us>
Permalink:  ../1793867.1736395064@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1793867.1736395064@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, guofenglinux@gmail.com, dqetool@126.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18764: server closed the connection unexpectedly
  In-Reply-To: <1793867.1736395064@sss.pgh.pa.us>

* 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