Re: pgsql: Allow insert and update tuple routing and COPY forforeign table - Mailing list pgsql-committers

From Laurenz Albe
Subject Re: pgsql: Allow insert and update tuple routing and COPY forforeign table
Date
Msg-id ed0b7471dce91169d871347cf003d8094ab96895.camel@cybertec.at
Whole thread Raw
In response to pgsql: Allow insert and update tuple routing and COPY for foreigntable  (Robert Haas <rhaas@postgresql.org>)
Responses Re: pgsql: Allow insert and update tuple routing and COPY for foreigntable  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Re: pgsql: Allow insert and update tuple routing and COPY for foreigntable  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Re: pgsql: Allow insert and update tuple routing and COPY for foreigntable  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Re: pgsql: Allow insert and update tuple routing and COPY for foreigntable  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Re: pgsql: Allow insert and update tuple routing and COPY for foreigntable  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
Re: pgsql: Allow insert and update tuple routing and COPY for foreigntable  (Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>)
List pgsql-committers
On Fri, 2018-04-06 at 23:24 +0000, Robert Haas wrote:
> Allow insert and update tuple routing and COPY for foreign tables.
> 
> Also enable this for postgres_fdw.
> 
> Etsuro Fujita, based on an earlier patch by Amit Langote. The larger
> patch series of which this is a part has been reviewed by Amit
> Langote, David Fetter, Maksim Milyutin, Álvaro Herrera, Stephen Frost,
> and me.  Minor documentation changes to the final version by me.
> 
> Discussion: http://postgr.es/m/29906a26-da12-8c86-4fb9-d8f88442f2b9@lab.ntt.co.jp

This commit makes life hard for foreign data wrappers that support
data modifications.

If a FDW implements ExecForeignInsert, this commit automatically assumes
that it also supports COPY FROM.  It will call ExecForeignInsert without
calling PlanForeignModify and BeginForeignModify, and a FDW that does not
expect that will probably fail.

So this commit silently turns a functioning FDW into a broken FDW.
That is not nice.  Probably not every FDW is aware of this change, and
maybe there are FDWs that support INSERT but don't want to support COPY
for some reason.

I propose that PostgreSQL only allows COPY FROM on a foreign table if the FDW
implements BeginForeignInsert.  The attached patch implements that.

I think this should be backpatched to v11.

Yours,
Laurenz Albe

Attachment

pgsql-committers by date:

Previous
From: Stephen Frost
Date:
Subject: pgsql: GSSAPI: Improve documentation and tests
Next
From: Bruce Momjian
Date:
Subject: pgsql: docs: reorder collation regression test order in paragraph