From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix postgres_fdw failure with whole-row Vars of type RECORD.
Date: Sat, 05 Jun 2021 00:07:14 +0000
Message-ID: <E1lpJqM-0004AH-Vw@gemulon.postgresql.org> (raw)
Fix postgres_fdw failure with whole-row Vars of type RECORD.
Commit 86dc90056 expects that FDWs can cope with whole-row Vars for
their tables, even if the Vars are marked with vartype RECORDOID.
Previously, whole-row Vars generated by the planner had vartype equal
to the relevant table's rowtype OID. (The point behind this change is
to enable sharing of resjunk columns across inheritance child tables.)
It turns out that postgres_fdw fails to cope with this, though through
bad fortune none of its test cases exposed that. Things mostly work,
but when we try to read back a value of such a Var, the expected
rowtype is not available to record_in(). Fortunately, it's not
difficult to hack up the tupdesc that controls this process to
substitute the foreign table's rowtype for RECORDOID. Thus we can
solve the runtime problem while still sharing the resjunk column
with other tables.
Per report from Alexander Pyhalov.
Discussion: https://postgr.es/m/7817fb9ebd6661cdf9b67dec6e129a78@postgrespro.ru
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f61db909dfb94f3411f8719916601a11a905b95e
Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 25 ++++++++++++
contrib/postgres_fdw/postgres_fdw.c | 55 +++++++++++++++++++++++++-
contrib/postgres_fdw/sql/postgres_fdw.sql | 8 ++++
3 files changed, 86 insertions(+), 2 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix postgres_fdw failure with whole-row Vars of type RECORD.
In-Reply-To: <E1lpJqM-0004AH-Vw@gemulon.postgresql.org>
References: <E1lpJqM-0004AH-Vw@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox