Please don't break threads by changing subject line. On Fri, Apr 6, 2018 at 3:42 PM, Ernst-Georg Schmid <ernst-georg.sch...@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