Re: pgsql: Allow insert and update tuple routing and COPY for foreign table

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>, Robert Haas <rhaas@postgresql.org>, pgsql-committers@lists.postgresql.org, pgsql-hackers@lists.postgresql.org
Date: 2019-04-22T20:27:03Z
Lists: pgsql-hackers
Hi,

On 2019-04-22 21:37:25 +0200, Laurenz Albe wrote:
> Subject: [PATCH] Foreign table COPY FROM and tuple routing requires
>  BeginForeignInsert
> 
> Commit 3d956d956a introduced support for foreign tables as partitions
> and COPY FROM on foreign tables.
> 
> If a foreign data wrapper supports data modifications, but either has
> not adapted to this change yet or doesn't want to support it
> for other reasons, it probably got broken by the above commit,
> because COPY will just call ExecForeignInsert anyway, which might not
> work because neither PlanForeignModify nor BeginForeignModify have
> been called.
> 
> To avoid breaking third-party foreign data wrappers in that way, allow
> COPY FROM and tuple routing for foreign tables only if the foreign data
> wrapper implements BeginForeignInsert.

Isn't this worse though? Before this it's an API change between major
versions. With this it's an API change in a *minor* version. Sure, it's
one that doesn't crash, but it's still a pretty substantial function
regression, no?

Greetings,

Andres Freund



Commits

  1. Add FDW documentation notes about insert and update tuple routing and COPY.

  2. Allow insert and update tuple routing and COPY for foreign tables.