pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: chocholousp@avast.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #11771: wrong behaviour of planner when pushing conditions
Date: Thu, 23 Oct 2014 15:05:41 -0400
Message-ID: <11165.1414091141@sss.pgh.pa.us> (raw)
In-Reply-To: <20141023153816.2676.95359@wrigleys.postgresql.org>
References: <20141023153816.2676.95359@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

chocholousp@avast.com writes:
> wrong behaviour of planner when pushing conditions from outer query to
> subselect

There's nothing wrong with what the planner did here.  There is no
constraint on reordering the application of WHERE clauses with an
inner join --- if there were, it'd be catastrophic to performance
in many real queries.

In the particular case at hand, what's actually happening is that
the two equalities

    t.t::uuid = x.t::uuid
    x.t::uuid = '88652f64-6cca-4ffa-a756-000007406ba6'::uuid

get reassociated into

    t.t::uuid = '88652f64-6cca-4ffa-a756-000007406ba6'::uuid
    x.t::uuid = '88652f64-6cca-4ffa-a756-000007406ba6'::uuid

so that the condition on t.t isn't a join condition at all and
can get applied to the (unprotected) scan of t.  So the condition
in the subselect has nothing to do with whether a failure occurs.
However, even without that, you would have had failures when the
join condition was applied, because the fact that x.t can validly
be cast to a uuid doesn't imply that every t.t value it could be
compared to can be cast to uuid.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)

Message-ID: <11165.1414091141@sss.pgh.pa.us>
Permalink:  ../11165.1414091141@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11165.1414091141@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 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: tgl@sss.pgh.pa.us, chocholousp@avast.com
  Subject: Re: BUG #11771: wrong behaviour of planner when pushing conditions
  In-Reply-To: <11165.1414091141@sss.pgh.pa.us>
  References: <20141023153816.2676.95359@wrigleys.postgresql.org> <11165.1414091141@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