Hi, Alexander.
On Mon, May 18, 2026 at 11:06 PM Alexander Pyhalov
<a.pyhalov@postgrespro.ru> wrote:
> Hi. I am a bit confused about this comment (and code):
>
> /*
> * DirectModify on a foreign join: pass NIL/0 for
> the function
> * metadata. We don't currently push function
> RTEs through the
> * direct-modify path, so there are no whole-row
> Vars pointing at
> * function-RTE tuples to reconstruct.
> */
> tupdesc = get_tupdesc_for_join_scan_tuples(node,
> NIL, 0);
>
> We evidently go through this code path when executing example
>
> UPDATE remote_tbl r SET b=5 FROM UNNEST(array[box '((2,3),(-2,-3))']) AS
> t (bx) WHERE r.a = area(t.bx)
> RETURNING a,b;
>
> But don't need whole row var in returning list.... However, we still can
> step on this issue.
Yes, we go through this code path, and it works as long as whole-row
var is not needed.
> UPDATE remote_tbl r SET b=5 FROM UNNEST(array[box '((2,3),(-2,-3))'],
> array[int '1']) AS t (bx, i) WHERE r.a = area(t.bx)
> RETURNING a,b,t;
>
> ERROR: input of anonymous composite types is not implemented
> CONTEXT: whole-row reference to foreign table "t"
But if whole row var is actually used, then the assumption is broken.
So, we need to build a whole-row var anyway. I've fixed this in the
attached patch, and added your sample query as a regression test case.
------
Regards,
Alexander Korotkov
Supabase