mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
Support writable foreign tables.
This patch adds the core-system infrastructure needed to support updates on foreign tables, and extends contrib/postgres_fdw to allow updates against remote Postgres servers. There's still a great deal of room for improvement in optimization of remote updates, but at least there's basic functionality there now. KaiGai Kohei, reviewed by Alexander Korotkov and Laurenz Albe, and rather heavily revised by Tom Lane.
This commit is contained in:
@ -571,7 +571,8 @@ subquery_planner(PlannerGlobal *glob, Query *parse,
|
||||
else
|
||||
rowMarks = root->rowMarks;
|
||||
|
||||
plan = (Plan *) make_modifytable(parse->commandType,
|
||||
plan = (Plan *) make_modifytable(root,
|
||||
parse->commandType,
|
||||
parse->canSetTag,
|
||||
list_make1_int(parse->resultRelation),
|
||||
list_make1(plan),
|
||||
@ -964,7 +965,8 @@ inheritance_planner(PlannerInfo *root)
|
||||
rowMarks = root->rowMarks;
|
||||
|
||||
/* And last, tack on a ModifyTable node to do the UPDATE/DELETE work */
|
||||
return (Plan *) make_modifytable(parse->commandType,
|
||||
return (Plan *) make_modifytable(root,
|
||||
parse->commandType,
|
||||
parse->canSetTag,
|
||||
resultRelations,
|
||||
subplans,
|
||||
@ -2035,6 +2037,15 @@ preprocess_rowmarks(PlannerInfo *root)
|
||||
if (rte->rtekind != RTE_RELATION)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Similarly, ignore RowMarkClauses for foreign tables; foreign tables
|
||||
* will instead get ROW_MARK_COPY items in the next loop. (FDWs might
|
||||
* choose to do something special while fetching their rows, but that
|
||||
* is of no concern here.)
|
||||
*/
|
||||
if (rte->relkind == RELKIND_FOREIGN_TABLE)
|
||||
continue;
|
||||
|
||||
rels = bms_del_member(rels, rc->rti);
|
||||
|
||||
newrc = makeNode(PlanRowMark);
|
||||
|
Reference in New Issue
Block a user