pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Andreas Karlsson <andreas@proxel.se>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: Ignored join clause
Date: Thu, 19 Apr 2018 12:59:40 +0100
Message-ID: <87efjbe8rz.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <87muy0dk4a.fsf@news-spur.riddles.org.uk>
References: <f8128b11-c5bf-3539-48cd-234178b2314d@proxel.se>
	<87muy0dk4a.fsf@news-spur.riddles.org.uk>

>>>>> "Andrew" == Andrew Gierth <andrew@tao11.riddles.org.uk> writes:

 Andrew> My suspicion is that this is an interaction between lateral and
 Andrew> join reordering. Looking into it further.

I think I was wrong, and that in fact this is a much more general
problem which amounts to a lack of communication between
get_joinrel_parampathinfo and extract_actual_join_clauses.

When we build the hash join path between q1 and q2,
get_joinrel_parampathinfo adds the q1.x=t.x clause to the
restrict_clauses list, but it doesn't distinguish it in any way from the
clauses that were there already.

Later when building the final Plan node for the hash join, we call
extract_actual_join_clauses to determine which clauses are join clauses
rather than filters. But this only looks at the RestrictInfo's
is_pushed_down field, and in this case that's wrong; is_pushed_down
isn't set, because the condition really was a join clause at the place
where it was originally written, but the condition has now been moved
from its original place by the parameterization and is effectively
pushed down even though it's not marked as such. So it ends up on the
wrong list.

-- 
Andrew (irc:RhodiumToad)




view thread (7+ messages)  latest in thread

Message-ID: <87efjbe8rz.fsf@news-spur.riddles.org.uk>
Permalink:  ../87efjbe8rz.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/87efjbe8rz.fsf@news-spur.riddles.org.uk

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, andreas@proxel.se
  Subject: Re: Ignored join clause
  In-Reply-To: <87efjbe8rz.fsf@news-spur.riddles.org.uk>
  References: <f8128b11-c5bf-3539-48cd-234178b2314d@proxel.se> <87muy0dk4a.fsf@news-spur.riddles.org.uk> <87efjbe8rz.fsf@news-spur.riddles.org.uk>

* 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