Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bCr0J-00013X-5h for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Jun 2016 16:15:51 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bCr0I-0003lX-No for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Jun 2016 16:15: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.84_2) (envelope-from ) id 1bCqyx-0002Aw-9R for pgsql-hackers@postgresql.org; Tue, 14 Jun 2016 16:14:27 +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 1bCqys-0008KK-LZ for pgsql-hackers@postgresql.org; Tue, 14 Jun 2016 16:14:25 +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 u5EGEER9009329; Tue, 14 Jun 2016 12:14:14 -0400 From: Tom Lane To: Robert Haas cc: Amit Kapila , David Rowley , Thomas Munro , Pg Hackers Subject: Re: ERROR: ORDER/GROUP BY expression not found in targetlist In-reply-to: References: <15695.1465827695@sss.pgh.pa.us> <17170.1465830165@sss.pgh.pa.us> <20756.1465834072@sss.pgh.pa.us> <1597.1465846969@sss.pgh.pa.us> <20391.1465850779@sss.pgh.pa.us> <22832.1465854401@sss.pgh.pa.us> <24309.1465856470@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Mon, 13 Jun 2016 18:44:58 -0400" Date: Tue, 14 Jun 2016 12:14:14 -0400 Message-ID: <9328.1465920854@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) 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 Robert Haas writes: > On Mon, Jun 13, 2016 at 6:21 PM, Tom Lane wrote: >> I think this is bad because it forces any external creators of >> UPPERREL_GROUP_AGG to duplicate that code --- and heaven help everybody >> if anyone is out of sync on whether to set the flag. So I'd rather keep >> set_grouped_rel_consider_parallel(), even if all it does is the above. >> And make it global not static. Ditto for the other upperrels. > I'm slightly mystified by this because we really shouldn't be setting > that flag more than once. We don't want to do that work repeatedly, > just once, and prior to adding any paths to the rel. Are you > imagining that somebody would try to created grouped paths before we > finish scan/join planning? Exactly. The original pathification design contemplated that FDWs and other extensions could inject Paths for the upperrels whenever they felt like it, specifically during relation path building. Even if you think that's silly, it *must* be possible to do it during GetForeignUpperPaths, else that hook is completely useless. Therefore, adding any data other than new Paths to the upperrel during create_grouping_paths is a broken design unless there is some easy, reliable, and not too expensive way for an FDW to make the same thing happen a bit earlier. See the commentary in optimizer/README starting at line 922. I generally don't like rel->consider_parallel at all for basically this reason, but it may be too late to undo that aspect of the parallel join planning design. I will settle for having an API call that allows FDWs to get the flag set correctly. Another possibility is to set the flag before calling GetForeignUpperPaths, but that might be messy too. 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