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

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?
Date: 2018-04-06 13:35:54
Message-ID: CAFjFpRdqXiP4_bRsjAGG6S0frXw1r06-fs38DjU9F4vgCc29ug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Apr 6, 2018 at 2:08 PM, Ernst-Georg Schmid
<ernst-georg(dot)schmid(at)bayer(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2018-04-06 13:39:21 Re: Vacuum: allow usage of more than 1GB of work mem
Previous Message Pavan Deolasee 2018-04-06 13:23:32 Re: pgsql: New files for MERGE