Re: Update does not move row across foreign partitions in v11 - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Update does not move row across foreign partitions in v11
Date
Msg-id 2396e176-ede8-cfbc-d012-fdb7a7e8b1f0@lab.ntt.co.jp
Whole thread Raw
In response to Re: Update does not move row across foreign partitions in v11  (David Rowley <david.rowley@2ndquadrant.com>)
Responses Re: Update does not move row across foreign partitions in v11
List pgsql-hackers
On 2019/03/06 12:47, David Rowley wrote:
> On Wed, 6 Mar 2019 at 16:29, Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp> wrote:
>> That means that rows can be moved from a local partition to a foreign
>> partition if the FDW supports it.
> 
> It seems a bit light on detail to me. If I was a user I'd want to know
> what exactly the FDW needed to support this. Does it need a special
> partition move function?  Looking at ExecFindPartition(), this check
> seems to be done in CheckValidResultRel() and is basically:
> 
> case RELKIND_FOREIGN_TABLE:
> /* Okay only if the FDW supports it */
> fdwroutine = resultRelInfo->ri_FdwRoutine;
> switch (operation)
> {
> case CMD_INSERT:
> if (fdwroutine->ExecForeignInsert == NULL)
> ereport(ERROR,
> (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
> errmsg("cannot insert into foreign table \"%s\"",
> RelationGetRelationName(resultRel))));
> 
> Alternatively, we could just remove the mention about "if the FDW
> supports it", since it's probably unlikely for an FDW not to support
> INSERT.

AFAIK, there's no special support in FDWs for "tuple moving" as such.  The
"if the FDW supports it" refers to the FDW's ability to handle tuple
routing.  Note that moving/re-routing involves calling
ExecPrepareTupleRouting followed by ExecInsert on the new tupls after the
old tuple is deleted.  If an FDW doesn't support tuple routing, then a
tuple cannot be moved into it.  That's what that text is talking about.

Maybe, we should reword it as "if the FDW supports tuple routing", so that
a reader doesn't go looking around for "tuple moving support" in FDWs.

Thanks,
Amit



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: Update does not move row across foreign partitions in v11
Next
From: Masahiko Sawada
Date:
Subject: Re: New vacuum option to do only freezing