Re: Get the name of the target Relation from Query struct? SOLVED! - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: Get the name of the target Relation from Query struct? SOLVED!
Date
Msg-id CAFjFpRenvB8i6NfiC8M6VXOy74rD528n-iAvCUUH1t-kGMbU1w@mail.gmail.com
Whole thread Raw
In response to AW: Get the name of the target Relation from Query struct? SOLVED!  (Ernst-Georg Schmid <ernst-georg.schmid@bayer.com>)
Responses AW: Get the name of the target Relation from Query struct? SOLVED!  (Ernst-Georg Schmid <ernst-georg.schmid@bayer.com>)
List pgsql-hackers
Please don't break threads by changing subject line.

On Fri, Apr 6, 2018 at 3:42 PM, Ernst-Georg Schmid
<ernst-georg.schmid@bayer.com> wrote:
> Hello David,
>
> actually Query->resultRelation is one based and Query->rtable is zero based.
>
> So the correct call to list_nth is: list_nth(Query->rtable, Query->resultRelation - 1)

As I suggested in the other mail, please use rt_fetch() or
planner_rt_fetch() that's future-proof in case we change relids to be
something-other-than-one based (an unlikely event, but who knows).
-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Vacuum: allow usage of more than 1GB of work mem
Next
From: Heikki Linnakangas
Date:
Subject: Re: Vacuum: allow usage of more than 1GB of work mem