Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi9iL-0005C1-2T for pgsql-bugs@arkaria.postgresql.org; Wed, 07 May 2014 21:49:21 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wi9iK-0004jG-I0 for pgsql-bugs@arkaria.postgresql.org; Wed, 07 May 2014 21:49:20 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi9iJ-0004i9-G5 for pgsql-bugs@postgresql.org; Wed, 07 May 2014 21:49:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wi9iG-0005aJ-CX for pgsql-bugs@postgresql.org; Wed, 07 May 2014 21:49:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s47LnFih005963; Wed, 7 May 2014 17:49:15 -0400 From: Tom Lane To: christopher.hamel@zimmer.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #10254: Joined Constraints not invoked on date ranges In-reply-to: <20140507152436.1397.689@wrigleys.postgresql.org> References: <20140507152436.1397.689@wrigleys.postgresql.org> Comments: In-reply-to christopher.hamel@zimmer.com message dated "Wed, 07 May 2014 15:24:36 -0000" Date: Wed, 07 May 2014 17:49:15 -0400 Message-ID: <5962.1399499355@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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