Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bCT4U-0004uj-OB for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Jun 2016 14:42:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bCT4T-0007Sv-Oi for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Jun 2016 14:42:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bCT38-0005zB-PI for pgsql-hackers@postgresql.org; Mon, 13 Jun 2016 14:41:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bCT36-00037y-Au for pgsql-hackers@postgresql.org; Mon, 13 Jun 2016 14:41:09 +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 u5DEf2fC016422; Mon, 13 Jun 2016 10:41:02 -0400 From: Tom Lane To: Amit Kapila cc: Robert Haas , 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> Comments: In-reply-to Amit Kapila message dated "Mon, 13 Jun 2016 20:01:38 +0530" Date: Mon, 13 Jun 2016 10:41:02 -0400 Message-ID: <16421.1465828862@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 Amit Kapila writes: > On Mon, Jun 13, 2016 at 7:51 PM, Tom Lane wrote: >> I think the real question here is why the code removed by 04ae11f62 >> was wrong. It was unsafe to use apply_projection_to_path, certainly, >> but using create_projection_path directly would have avoided the >> stated problem. And it's very unclear that this new patch doesn't >> bring back that bug in a different place. > This new patch still doesn't seem to be right, but it won't bring back the > original problem because apply_projection_to_path will be only done if > grouped_rel is parallel_safe which means it doesn't have any > parallel-unsafe or parallel-restricted clause in quals or target list. The problem cited in 04ae11f62's commit message is that apply_projection_to_path would overwrite the paths' pathtargets in-place, causing problems if they'd been used for other purposes elsewhere. I do not share your confidence that using apply_projection_to_path within create_grouping_paths is free of such a hazard. 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