On Wed, 6 Mar 2019 at 17:20, Amit Langote <langote_amit...@lab.ntt.co.jp> wrote: > > On 2019/03/06 12:47, David Rowley wrote: > > 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.
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? As far as I can tell, this is just the requirements as defined in CheckValidResultRel() for CMD_INSERT. Fragments of which I pasted above. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services