pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Change more places to be less trusting of RestrictInfo.is_pushed
Date: Fri, 20 Apr 2018 19:19:43 +0000
Message-ID: <E1f9bZP-00074T-Oq@gemulon.postgresql.org> (raw)

Change more places to be less trusting of RestrictInfo.is_pushed_down.

On further reflection, commit e5d83995e didn't go far enough: pretty much
everywhere in the planner that examines a clause's is_pushed_down flag
ought to be changed to use the more complicated behavior where we also
check the clause's required_relids.  Otherwise we could make incorrect
decisions about whether, say, a clause is safe to use as a hash clause.

Some (many?) of these places are safe as-is, either because they are
never reached while considering a parameterized path, or because there
are additional checks that would reject a pushed-down clause anyway.
However, it seems smarter to just code them all the same way rather
than rely on easily-broken reasoning of that sort.

In support of that, invent a new macro RINFO_IS_PUSHED_DOWN that should
be used in place of direct tests on the is_pushed_down flag.

Like the previous patch, back-patch to all supported branches.

Discussion: https://postgr.es/m/f8128b11-c5bf-3539-48cd-234178b2314d@proxel.se

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c792c7db41466ff02107e3233ec9d92d8e3df866

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c       |  3 ++-
src/backend/optimizer/path/costsize.c     | 10 +++++++--
src/backend/optimizer/path/joinpath.c     |  4 ++--
src/backend/optimizer/path/joinrels.c     | 34 ++++++++++++++++++-------------
src/backend/optimizer/plan/analyzejoins.c | 10 ++++-----
src/backend/optimizer/plan/initsplan.c    |  5 +++++
src/backend/optimizer/util/relnode.c      |  3 ++-
src/backend/optimizer/util/restrictinfo.c | 12 ++---------
src/include/nodes/relation.h              | 17 +++++++++++++++-
src/include/optimizer/paths.h             |  3 ++-
10 files changed, 64 insertions(+), 37 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1f9bZP-00074T-Oq@gemulon.postgresql.org>
Permalink:  ../E1f9bZP-00074T-Oq@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1f9bZP-00074T-Oq@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Change more places to be less trusting of RestrictInfo.is_pushed
  In-Reply-To: <E1f9bZP-00074T-Oq@gemulon.postgresql.org>
  References: <E1f9bZP-00074T-Oq@gemulon.postgresql.org>

* 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