Re: ERROR: ORDER/GROUP BY expression not found in targetlist - Mailing list pgsql-hackers

From Tom Lane
Subject Re: ERROR: ORDER/GROUP BY expression not found in targetlist
Date
Msg-id 16421.1465828862@sss.pgh.pa.us
Whole thread Raw
In response to ERROR: ORDER/GROUP BY expression not found in targetlist  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: ERROR: ORDER/GROUP BY expression not found in targetlist
List pgsql-hackers
Amit Kapila <amit.kapila@enterprisedb.com> writes:
> On Mon, Jun 13, 2016 at 7:51 PM, Tom Lane <tgl@sss.pgh.pa.us> 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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ERROR: ORDER/GROUP BY expression not found in targetlist
Next
From: Tom Lane
Date:
Subject: Re: ERROR: ORDER/GROUP BY expression not found in targetlist