public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Richard Guo <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: Robert Haas <[email protected]>
Subject: Re: BUG #19460: FULL JOIN rewriting issue on empty queries
Date: Sun, 19 Apr 2026 21:26:14 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAMbWs48E2qqd4B6AdvJDyPBi685-_bDEvoe0aJnYzAPL1v30zg@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<CAMbWs48E2qqd4B6AdvJDyPBi685-_bDEvoe0aJnYzAPL1v30zg@mail.gmail.com>
Richard Guo <[email protected]> writes:
> On Mon, Apr 20, 2026 at 6:10 AM Tom Lane <[email protected]> wrote:
>> This turns out to be because somebody long ago thought that outer join
>> removal could be lazy about how much of the planner's data structures
>> it needs to update. Specifically, when the lower LEFT OUTER JOIN
>> gets removed, we failed to remove the associated relids from the
>> left_relids and right_relids of the upper "ON rhs.id = lhs.id" clause,
>> and that blocks recognition of the applicability of a hash or merge
>> join, because clause_sides_match_join() fails.
> I came to the same conclusion.
Thanks for looking at it! There is a loose end still bothering me:
if you remove the lower "WHERE t.id = ..." clause, or change it to be
something other than an equality constraint on t.id, the bug doesn't
manifest. The reason for that is un-obvious. I suppose it's somehow
related to the code that tries to push equality-to-a-constant through
outer join clauses, but that code shouldn't be able to produce any new
clauses here, so why is there a visible effect? I'm too tired to look
right now, and was planning to study it more tomorrow. But if you
are interested in digging before that, feel free.
regards, tom lane
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: BUG #19460: FULL JOIN rewriting issue on empty queries
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox