pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Richard Guo <guofenglinux@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware)
Date: Thu, 18 May 2023 09:28:33 -0400
Message-ID: <3732983.1684416513@sss.pgh.pa.us> (raw)
In-Reply-To: <CAMbWs4-EU9uBGSP7G-iTwLBhRQ=rnZKvFDhD+n+xhajokyPCKg@mail.gmail.com>
References: <0b819232-4b50-f245-1c7d-c8c61bf41827@postgrespro.ru>
	<CAMbWs4_HJNuLv9HDReEBDrQrCPV-uqpVOecoJkurprnY+Do9Fg@mail.gmail.com>
	<CAMbWs4_8EZU4DetHyZGm1CwCxUhBdWpRnA9dtM-Z82i=bVKA6A@mail.gmail.com>
	<CAMbWs4_XcPHqc=A=36cxvJRhkjAgEeJtOFLOnBPEfQYGqnGOCw@mail.gmail.com>
	<efb33bee-145d-95a8-1048-2e7b8f282e2c@postgrespro.ru>
	<CAMbWs48FHw_tTXSbA-_MPaeu7S7JCt6Xs-gxwkx=pvLiwC6eTg@mail.gmail.com>
	<c69bd07e-1175-10da-9ac0-4bfe59235ac2@postgrespro.ru>
	<402433.1677524538@sss.pgh.pa.us>
	<2663884e-769a-b298-55b0-014c5a1ee55c@postgrespro.ru>
	<524303.1677538463@sss.pgh.pa.us>
	<999171.1677611407@sss.pgh.pa.us>
	<CAMbWs4-Pi5cM=V8B-g5Qfnr0t3EgAbhus0YNQN=XquJ8fNoatw@mail.gmail.com>
	<CAMbWs4-Pmh9umsUbfs8Lay=k6wFrsuLdLJ7ci=Af6DqAwsN1Hg@mail.gmail.com>
	<CA+TgmoZ9yQLYziHAbt_X3hpU8FKkPXGLV=OhoD-GejAUckQbrA@mail.gmail.com>
	<CA+TgmoaeccFHN9ouXiSQmMJVh6uF-ANbbDjrwopQ+icYyzJSJw@mail.gmail.com>
	<CAMbWs4_nudsuzd-bLLgu1WCzeV1pLv3SG1Ub8vo-ETJzvgc0Bg@mail.gmail.com>
	<1526312.1683912310@sss.pgh.pa.us>
	<CA! MbWs4-Kx3ZHUByn6D2ZUTeF4Fm7uudkzgHNguDutpV8tepxtg@mail.gmail.com>
	<2766442.1684265014@sss.pgh.pa.us>
	<3014965.1684293045@sss.pgh.pa.us>
	<CAMbWs48iJprH69xQ27nigwODu1m_4U3Y2WMTxk47sTVdkW0Seg@mail.gmail.com>
	<3344781.1684337332@sss.pgh.pa.us>
	<CAMbWs4-EU9uBGSP7G-iTwLBhRQ=rnZKvFDhD+n+xhajokyPCKg@mail.gmail.com>

Richard Guo <guofenglinux@gmail.com> writes:
> BTW, it seems that there is a minor thinko in the changes.  In the
> outer-join removal logic, we use syn_xxxhand to compute the relid set
> for the join we are considering to remove.  I think this might be not
> right, because the outer joins may not be performed in syntactic order.

No, I don't believe that.  What we are interested in at this point is
the semantic effect (or lack of it) of the potentially-removable join.
It's fine to reason about that under the assumption that the joins will
be done in syntactic order.  If later parts of the planner decide to
implement the joins in a different order, that cannot change the
conclusion about whether it's safe to remove a join --- otherwise,
either we were mistaken to remove the join, or the reordering logic
is wrong.

I prefer the code as it stands now because it helps to decouple the
join-removal reasoning from the join-reordering logic, limiting any
possible effect of bugs in the latter.  (I think I might've had
some other reason for changing it as well, but can't reconstruct
that first thing in the morning.)

			regards, tom lane





view thread (46+ messages)  latest in thread

Message-ID: <3732983.1684416513@sss.pgh.pa.us>
Permalink:  ../3732983.1684416513@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3732983.1684416513@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, guofenglinux@gmail.com, robertmhaas@gmail.com, a.lepikhov@postgrespro.ru, pgsql-bugs@lists.postgresql.org
  Subject: Re: Clause accidentally pushed down ( Possible bug in Making Vars outer-join aware)
  In-Reply-To: <3732983.1684416513@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