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

2019-04-26 Thread Etsuro Fujita
(2019/04/26 13:58), Etsuro Fujita wrote: (2019/04/26 13:20), Amit Langote wrote: + Note that this function is also called when inserting routed tuples into + a foreign-table partition or executingCOPY FROM on + a foreign table, in which case it is called in a different way than it + is in

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

2019-04-25 Thread Etsuro Fujita
Amit-san, (2019/04/26 13:20), Amit Langote wrote: On 2019/04/25 22:17, Etsuro Fujita wrote: (2019/04/24 22:04), Laurenz Albe wrote: Before PostgreSQL v11, a foreign data wrapper could be certain that BeginForeignModify is always called before ExecForeignInsert. This is no longer

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

2019-04-25 Thread Amit Langote
Fujita-san, On 2019/04/25 22:17, Etsuro Fujita wrote: > (2019/04/24 22:04), Laurenz Albe wrote: >>    Before PostgreSQL v11, a foreign data wrapper could be certain that >>    BeginForeignModify is always called before ExecForeignInsert. >>    This is no longer true. > > OK, how about something

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

2019-04-25 Thread Laurenz Albe
On Thu, 2019-04-25 at 22:17 +0900, Etsuro Fujita wrote: > > The documentation of ExecForeignInsert should mention something like: > > > >ExecForeignInsert is called for INSERT statements as well > >as for COPY FROM and tuples that are inserted into a foreign table > >because it is a

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

2019-04-25 Thread Etsuro Fujita
(2019/04/24 22:04), Laurenz Albe wrote: On Wed, 2019-04-24 at 20:54 +0900, Etsuro Fujita wrote: How about adding to the documentation for BeginForeignInsert a mention that if an FDW doesn't support COPY FROM and/or routable foreign tables, it must throw an error in BeginForeignInsert

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

2019-04-24 Thread Laurenz Albe
On Wed, 2019-04-24 at 14:25 +0100, Simon Riggs wrote: > On Wed, 24 Apr 2019 at 12:55, Etsuro Fujita > wrote: > > > > My point is that this should not be necessary. > > > > In my opinion, I think this is necessary... > > Could we decide by looking at what FDWs are known to exist? > I hope we

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

2019-04-24 Thread Simon Riggs
On Wed, 24 Apr 2019 at 12:55, Etsuro Fujita wrote: > > My point is that this should not be necessary. > > In my opinion, I think this is necessary... > Could we decide by looking at what FDWs are known to exist? I hope we are trying to avoid breakage in the smallest number of FDWs. -- Simon

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

2019-04-24 Thread Laurenz Albe
On Wed, 2019-04-24 at 20:54 +0900, Etsuro Fujita wrote: > How about adding to the documentation for BeginForeignInsert a mention > that if an FDW doesn't support COPY FROM and/or routable foreign tables, > it must throw an error in BeginForeignInsert accordingly. Sure, some more documentation

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

2019-04-24 Thread Etsuro Fujita
(2019/04/23 4:37), Laurenz Albe wrote: On Mon, 2019-04-22 at 21:45 +0900, Etsuro Fujita wrote: (2019/04/20 20:53), Laurenz Albe wrote: On Fri, 2018-04-06 at 23:24 +, Robert Haas wrote: Allow insert and update tuple routing and COPY for foreign tables. Also enable this for postgres_fdw.

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

2019-04-23 Thread Amit Langote
On 2019/04/22 21:45, Etsuro Fujita wrote: > (2019/04/20 20:53), Laurenz Albe wrote: >> I propose that PostgreSQL only allows COPY FROM on a foreign table if >> the FDW >> implements BeginForeignInsert.  The attached patch implements that. > > I don't think that is a good idea, because there might

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

2019-04-23 Thread Laurenz Albe
On Mon, 2019-04-22 at 14:07 -0700, Andres Freund wrote: > 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

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

2019-04-22 Thread Andres Freund
Hi, On 2019-04-22 22:56:20 +0200, Laurenz Albe wrote: > 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

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

2019-04-22 Thread Laurenz Albe
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

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

2019-04-22 Thread Laurenz Albe
On Mon, 2019-04-22 at 16:24 -0400, Robert Haas wrote: > On Mon, Apr 22, 2019 at 3:37 PM Laurenz Albe wrote: > > Sure, it is not hard to modify a FDW to continue working with v11. > > > > My point is that this should not be necessary. > > I'm not sure whether this proposal is a good idea or a

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

2019-04-22 Thread Andres Freund
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

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

2019-04-22 Thread Robert Haas
On Mon, Apr 22, 2019 at 3:37 PM Laurenz Albe wrote: > Sure, it is not hard to modify a FDW to continue working with v11. > > My point is that this should not be necessary. I'm not sure whether this proposal is a good idea or a bad idea, but I think that it's inevitable that FDWs are going to

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

2019-04-22 Thread Laurenz Albe
On Mon, 2019-04-22 at 21:45 +0900, Etsuro Fujita wrote: Thanks for looking into this! > (2019/04/20 20:53), Laurenz Albe wrote: > > On Fri, 2018-04-06 at 23:24 +, Robert Haas wrote: > > > Allow insert and update tuple routing and COPY for foreign tables. > > > > > > Also enable this for

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

2019-04-22 Thread Etsuro Fujita
(2019/04/20 20:53), Laurenz Albe wrote: On Fri, 2018-04-06 at 23:24 +, 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

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

2019-04-21 Thread Amit Langote
Hi, On 2019/04/20 20:53, Laurenz Albe wrote: > On Fri, 2018-04-06 at 23:24 +, 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

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

2019-04-21 Thread Etsuro Fujita
(2019/04/20 20:53), Laurenz Albe wrote: On Fri, 2018-04-06 at 23:24 +, 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

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

2019-04-20 Thread Laurenz Albe
On Fri, 2018-04-06 at 23:24 +, 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