Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YfGLi-0006EA-Ui for pgsql-committers@arkaria.postgresql.org; Mon, 06 Apr 2015 23:22:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YfGLh-0001ci-PW for pgsql-committers@arkaria.postgresql.org; Mon, 06 Apr 2015 23:22:33 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YfGLg-0001cb-U9 for pgsql-committers@postgresql.org; Mon, 06 Apr 2015 23:22:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YfGLX-0005Ys-Jp for pgsql-committers@postgresql.org; Mon, 06 Apr 2015 23:22:31 +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 t36NMJSI022813; Mon, 6 Apr 2015 19:22:19 -0400 From: Tom Lane To: Qingqing Zhou cc: pgsql-committers@postgresql.org Subject: Re: pgsql: Fix incorrect matching of subexpressions in outer-join plan node In-reply-to: References: Comments: In-reply-to Qingqing Zhou message dated "Mon, 06 Apr 2015 14:43:32 -0700" Date: Mon, 06 Apr 2015 19:22:19 -0400 Message-ID: <22812.1428362539@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org Qingqing Zhou writes: > On Sat, Apr 4, 2015 at 4:55 PM, Tom Lane wrote: >> (This is somewhat overkill, in that a strict expression could still be >> matched, but it doesn't seem worth the effort to check that.) > Just curious, checking an expression strictness is convenient in > build_tlist_index() like this: > TargetEntry *tle = (TargetEntry *) lfirst(l); > + if (contain_nonstrict_functions((Node *)tle)) > + *hasnonstrict = true; > + > And this will almost avoid the overkill at once. Why not do this? Because it's expensive (a syscache lookup per function or operator). And that test alone would be insufficient anyway: you'd also have to check that there was an appropriate Var in the expression, cf the comment for contain_nonstrict_functions. regards, tom lane -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers