Re: Creating unique or "internal-use-only" column names (ColumnRef) - Mailing list pgsql-hackers

From Peter Moser
Subject Re: Creating unique or "internal-use-only" column names (ColumnRef)
Date
Msg-id 55EEA234.5080307@gmail.com
Whole thread Raw
In response to Re: Creating unique or "internal-use-only" column names (ColumnRef)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Am 07.09.2015 um 16:40 schrieb Tom Lane:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> On 09/07/2015 09:28 AM, Alvaro Herrera wrote:
>>> This seems pretty much the same as a junk attribute, if I understand you
>>> correctly.  I suggest given a look at how those work.
>
>> Is that actually documented anywhere much?
>
> I don't think there's much besides a code comment here and there.
> Grepping for functions that touch the "resjunk" field of TargetListEntries
> should give you the lay of the land.
>
>             regards, tom lane
>

I have marked them as resjunk already. The problem is that the subquery 
I build contains another subquery. As SQL it looks something like the 
following:

select *
from(select *, row_number() over () rn from r) r
left outer join(select *, ts p1 from r    union all select *, te p1 from r) s
on p1 >= r.ts and p1 < r.te
order by rn, p1;

I set then the output columns of the outer select to resjunk for rn and 
p1, like this...

i = list_length(qry->targetList);
get_tle_by_resno(qry->targetList, i)->resjunk = true;
get_tle_by_resno(qry->targetList, --i)->resjunk = true;


However, I cannot do that inside, because I need them above... or do I 
miss something here?

~peter



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: [HACKERS] 答复:[HACKERS] about fsync in CLOG buffer write
Next
From: Etsuro Fujita
Date:
Subject: Re: Hooking at standard_join_search (Was: Re: Foreign join pushdown vs EvalPlanQual)