Tom Lane писал 2021-06-02 00:32:
I wrote:
I think a preferable fix involves making sure that the correct
record-type typmod is propagated to record_in in this context.
Alternatively, maybe we could insert the foreign table's rowtype
during execution of the input operation, without touching the
plan as such.

Here's a draft-quality patch based on that idea.  It resolves
the offered test case, but I haven't beat on it beyond that.

                        regards, tom lane

Hi.
The patch seems to work fine for mentioned case.
For now I'm working on function pushdown. When record-returning function (like unnest()) is pushed down, on this stage we've already lost any type information, so get the issue again. So far I'm not sure how to fix the issue, perhaps just avoid pushing foreign join if we have
record, corresponding to function RTE var in joinrel->reltarget?

--
Best regards,
Alexander Pyhalov,
Postgres Professional


Reply via email to