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 333528b0ada7111cb6bc51cae6158f92d4e9d0f1.camel@cybertec.at
Whole thread Raw
In response to Re: pgsql: Allow insert and update tuple routing and COPY forforeign table  (Andres Freund <andres@anarazel.de>)
Responses Re: pgsql: Allow insert and update tuple routing and COPY forforeign table  (Andres Freund <andres@anarazel.de>)
Re: pgsql: Allow insert and update tuple routing and COPY forforeign table  (Andres Freund <andres@anarazel.de>)
List pgsql-committers
On Mon, 2019-04-22 at 13:27 -0700, Andres Freund wrote:
> On 2019-04-22 21:37:25 +0200, Laurenz Albe wrote:
> > 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?

Hm, that's a good point.
You could say that this patch is too late, because a FDW might already be
relying on COPY FROM to work without BeginForeignInsert in v11.

How about just applying the patch from v12 on?
Then it is a behavior change in a major release, which is acceptable.
It requires the imaginary FDW above to add an empty BeginForeignInsert
callback function, but will unbreak FDW that slept through the change
that added COPY support.

Yours,
Laurenz Albe




pgsql-committers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: pgsql: Allow insert and update tuple routing and COPY forforeign table
Next
From: Andres Freund
Date:
Subject: Re: pgsql: Allow insert and update tuple routing and COPY forforeign table