Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fPWXn-0005HG-Gy for pgsql-hackers@arkaria.postgresql.org; Sun, 03 Jun 2018 17:11:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fPWXm-0002hd-8B for pgsql-hackers@arkaria.postgresql.org; Sun, 03 Jun 2018 17:11:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fPWXm-0002hT-1W for pgsql-hackers@lists.postgresql.org; Sun, 03 Jun 2018 17:11:50 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fPWXj-0002gU-0P for pgsql-hackers@lists.postgresql.org; Sun, 03 Jun 2018 17:11:49 +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 w53HBeL9010433; Sun, 3 Jun 2018 13:11:40 -0400 From: Tom Lane To: Dmitry Dolgov <9erthalion6@gmail.com> cc: Jeff Janes , Ashutosh Bapat , Pavel Stehule , PostgreSQL Hackers Subject: Re: why partition pruning doesn't work? In-reply-to: References: <7142.1527868419@sss.pgh.pa.us> <1111.1527977170@sss.pgh.pa.us> Comments: In-reply-to Dmitry Dolgov <9erthalion6@gmail.com> message dated "Sun, 03 Jun 2018 18:44:33 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10431.1528045900.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 03 Jun 2018 13:11:40 -0400 Message-ID: <10432.1528045900@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Dmitry Dolgov <9erthalion6@gmail.com> writes: > Just to clarify for myself, for evaluating any stable function here woul= d it be > enough to handle all function-like expressions (FuncExpr / OpExpr / > DistinctExpr / NullIfExpr) and check a corresponding function for provol= atile, > like in the attached patch? I think the entire approach is wrong here. Rather than concerning yourself with Params, or any other specific expression type, you should be using !contain_volatile_functions() to decide whether an expression is run-time-constant. If it is, use the regular expression evaluation machinery to extract the value. regards, tom lane