Re: Update does not move row across foreign partitions in v11

From: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Derek Hans <derek(dot)hans(at)gmail(dot)com>
Subject: Re: Update does not move row across foreign partitions in v11
Date: 2019-03-06 06:16:25
Message-ID: 5C7F65B9.9050804@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

(2019/03/06 13:53), Amit Langote wrote:
> On 2019/03/06 13:30, David Rowley wrote:

>> I think you missed my point. If there's no special support for "tuple
>> moving", as you say, then what help is it to tell the user "if the FDW
>> supports tuple routing"? The answer is, it's not any help. How would
>> the user check such a fact?
>
> Hmm, maybe getting the following error, like one would get in PG 10 when
> using postgres_fdw-managed partitions:
>
> ERROR: cannot route inserted tuples to a foreign table
>
> Getting the above error is perhaps not the best way for a user to learn of
> this fact, but maybe we (and hopefully other FDW authors) mention this in
> the documentation?

+1

>> As far as I can tell, this is just the requirements as defined in
>> CheckValidResultRel() for CMD_INSERT. Fragments of which I pasted
>> above.
>
> Only supporting INSERT doesn't suffice though. An FDW which intends to
> support tuple routing and hence 1-way tuple moving needs to updated like
> postgres_fdw was in PG 11.

That's right; the "if the FDW supports it" in the documentation refers
to the FDW's support for the callback functions BeginForeignInsert() and
EndForeignInsert() described in 57.2.4. FDW Routines For Updating
Foreign Tables [1] in addition to ExecForeignInsert(), as stated there:

"Tuples inserted into a partitioned table by INSERT or COPY FROM are
routed to partitions. If an FDW supports routable foreign-table
partitions, it should also provide the following callback functions."

Best regards,
Etsuro Fujita

[1]
https://www.postgresql.org/docs/current/fdw-callbacks.html#FDW-CALLBACKS-UPDATE

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Amit Langote 2019-03-06 06:34:12 Re: Update does not move row across foreign partitions in v11
Previous Message Etsuro Fujita 2019-03-06 06:10:38 Re: Update does not move row across foreign partitions in v11

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2019-03-06 06:22:59 Re: [HACKERS] Block level parallel vacuum
Previous Message Etsuro Fujita 2019-03-06 06:10:38 Re: Update does not move row across foreign partitions in v11