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

From Ashutosh Bapat
Subject Re: Get the name of the target Relation from Query struct?
Date
Msg-id CAFjFpRdqXiP4_bRsjAGG6S0frXw1r06-fs38DjU9F4vgCc29ug@mail.gmail.com
Whole thread Raw
In response to AW: Get the name of the target Relation from Query struct?  (Ernst-Georg Schmid <ernst-georg.schmid@bayer.com>)
List pgsql-hackers
On Fri, Apr 6, 2018 at 2:08 PM, Ernst-Georg Schmid
<ernst-georg.schmid@bayer.com> wrote:

>
>     if(parse->commandType != CMD_SELECT) {
>         int resultRelation = parse->resultRelation;
>
>         rte = (RangeTblEntry *) list_nth(parse->rtable, resultRelation);
>

list_nth() assumes that the lists are 0 based. But relations indexes
are 1 based. Please use rt_fetch() or planner_rt_fetch() as suitable.



-- 
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company


pgsql-hackers by date:

Previous
From: Pavan Deolasee
Date:
Subject: Re: pgsql: New files for MERGE
Next
From: Heikki Linnakangas
Date:
Subject: Re: Vacuum: allow usage of more than 1GB of work mem