Re: BUG #10254: Joined Constraints not invoked on date ranges

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: christopher(dot)hamel(at)zimmer(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #10254: Joined Constraints not invoked on date ranges
Date: 2014-05-07 21:49:15
Message-ID: 5962.1399499355@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

christopher(dot)hamel(at)zimmer(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Emanuel Calvo 2014-05-07 22:24:53 Re: BUG #10255: CREATE COLLATION bug on 9.4
Previous Message Tom Lane 2014-05-07 21:42:19 Re: BUG #10256: COUNT(*) behaves sort of like RANK() when used over a window containing an ORDER BY