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)

The comment "rtable index of target relation for INSERT/UPDATE/DELETE/MERGE; 0 
for SELECT" on resultRelation in parsenodes.h, Line 120 is misleading. It is 
_not_ a direct index into rtable, you have to subtract 1 first!

And now it works...checked against 9.6.8 and 10.3.

Best regards,

Ernst-Georg

Reply via email to