pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: christopher.hamel@zimmer.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #10254: Joined Constraints not invoked on date ranges
Date: Wed, 07 May 2014 17:49:15 -0400
Message-ID: <5962.1399499355@sss.pgh.pa.us> (raw)
In-Reply-To: <20140507152436.1397.689@wrigleys.postgresql.org>
References: <20140507152436.1397.689@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

christopher.hamel@zimmer.com writes:
> If I specifically invoke the range on both the h and l tables, it will work
> fine, but since the join specifies those fields have to be the same, can
> that condition be propagated automatically?

No.  We currently deduce equality transitively, so the planner is able to
extract the constraint l.transaction_date = '2014-03-01' from your query
(and then use that to reason about the check constraints on l's children).
But there's nothing comparable for inequalities, and it's not clear that
adding such logic to the planner would be a net win.  It would be more
complicated than the equality case and less often useful.

			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: <5962.1399499355@sss.pgh.pa.us>
Permalink:  ../5962.1399499355@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/5962.1399499355@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, christopher.hamel@zimmer.com
  Subject: Re: BUG #10254: Joined Constraints not invoked on date ranges
  In-Reply-To: <5962.1399499355@sss.pgh.pa.us>
  References: <20140507152436.1397.689@wrigleys.postgresql.org> <5962.1399499355@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