Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cy1lg-0005gb-0Z for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Apr 2017 19:48:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cy1le-0003K7-Of for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Apr 2017 19:47:58 +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.84_2) (envelope-from ) id 1cy1ld-0003Im-C2 for pgsql-hackers@postgresql.org; Tue, 11 Apr 2017 19:47:57 +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.84_2) (envelope-from ) id 1cy1la-00060h-H3 for pgsql-hackers@postgresql.org; Tue, 11 Apr 2017 19:47:56 +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 v3BJloE6000368; Tue, 11 Apr 2017 15:47:50 -0400 From: Tom Lane To: Dmitry Ivanov cc: pgsql-hackers Subject: Re: Possible problem in Custom Scan API In-reply-to: <1ef85b46-1385-4810-bb80-97cd977da1d5@postgrespro.ru> References: <20021.1491933424@sss.pgh.pa.us> <1ef85b46-1385-4810-bb80-97cd977da1d5@postgrespro.ru> Comments: In-reply-to Dmitry Ivanov message dated "Tue, 11 Apr 2017 21:33:15 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <366.1491940070.1@sss.pgh.pa.us> Date: Tue, 11 Apr 2017 15:47:50 -0400 Message-ID: <367.1491940070@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-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Dmitry Ivanov writes: > Tom Lane wrote: >> Uh, why would you see that? The planner would never generate an >> IndexOnlyScan in the first place if the query required any columns >> not available from the index. > True, but as you can see, create_append_plan() produces its own targetlist: > static Plan * > create_append_plan(PlannerInfo *root, AppendPath *best_path) > { > Append *plan; > List *tlist = build_path_tlist(root, &best_path->path); > ... > If we replace Append with some custom node, the plan will instantly become > invalid (it won't be be able to build a projection from 'custom_scan_tlist' > to 'targetlist'). However, this doesn't mean that it's unable to produce > the same result. You haven't really convinced me that anything is wrong there. The append plan's tlist isn't going to contain unwanted variables either. Reading between the lines, I think the problem may be that you're not being careful about how you set up custom_scan_tlist. But since the core code has zero involvement in that decision, it's hard to see why it would be a core code bug. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers