Re: Get the name of the target Relation from Query struct? SOLVED!

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Ernst-Georg Schmid <ernst-georg(dot)schmid(at)bayer(dot)com>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Get the name of the target Relation from Query struct? SOLVED!
Date: 2018-04-06 13:40:13
Message-ID: CAFjFpRenvB8i6NfiC8M6VXOy74rD528n-iAvCUUH1t-kGMbU1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)schmid(at)bayer(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2018-04-06 13:42:17 Re: Vacuum: allow usage of more than 1GB of work mem
Previous Message Heikki Linnakangas 2018-04-06 13:39:21 Re: Vacuum: allow usage of more than 1GB of work mem