Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRdIa-0001FK-Fe for pgsql-bugs@arkaria.postgresql.org; Fri, 17 May 2019 13:53:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hRdIY-00075K-SX for pgsql-bugs@arkaria.postgresql.org; Fri, 17 May 2019 13:53:22 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRdIY-00075D-Kv for pgsql-bugs@lists.postgresql.org; Fri, 17 May 2019 13:53:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRdIV-00023e-Vc for pgsql-bugs@lists.postgresql.org; Fri, 17 May 2019 13:53:22 +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 x4HDrBNN007236; Fri, 17 May 2019 09:53:11 -0400 From: Tom Lane To: Amit Langote cc: David Rowley , Kyotaro HORIGUCHI , Alan Jackson , PostgreSQL mailing lists Subject: Re: inconsistent results querying table partitioned by date In-reply-to: References: <28453.1557867500@sss.pgh.pa.us> <588f56cb-aaed-14b0-8a21-13486bd1c706@lab.ntt.co.jp> <10502.1557941878@sss.pgh.pa.us> <23372.1557966530@sss.pgh.pa.us> <14871.1558022797@sss.pgh.pa.us> <12600.1558034735@sss.pgh.pa.us> <7099.1558047050@sss.pgh.pa.us> Comments: In-reply-to Amit Langote message dated "Fri, 17 May 2019 19:49:19 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <7234.1558101191.1@sss.pgh.pa.us> Date: Fri, 17 May 2019 09:53:11 -0400 Message-ID: <7235.1558101191@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Langote writes: > As promised, here is the idea I was thinking of, although I'm no longer > confident you will like it based on your previous emails on this thread. > I was thinking of having a walker function that traverses the list of > *clauses* that were passed to make_partition_pruneinfo(), which puts the > paramids into an output context struct, with separate Bitmapsets for > PARAM_EXTERN and PARAM_EXEC parameters. In addition to running this > walker, also do a contain_mutable_functions() pass over the clauses. (I > can already hear a big no at this point!) As you might've guessed, the > result of those two steps would decide whether we need to do the the extra > gen_partprune_steps() steps. Fwiw, I prototyped it in the attached patch > which applies on top of yours. Actually, yeah, my thoughts about future development were to split up the gen_partprune_steps processing to avoid the duplicated work. I've not read your patch yet but this sounds like the same idea. What I'm worried about is if it's too much code churn for a back-patchable bug fix. regards, tom lane