aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-12-12 12:41:55 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-12-12 12:41:55 -0500
commitcfc878a45c4834ce8a09523d0d72b42ece8bab7a (patch)
tree99ed384ec419552df6e72adc14edea27b90010d1 /contrib/postgres_fdw/postgres_fdw.c
parent2ae8a01ca1af074c166e3f882869dfe307b91b2c (diff)
downloadpostgresql-cfc878a45c4834ce8a09523d0d72b42ece8bab7a.tar.gz
postgresql-cfc878a45c4834ce8a09523d0d72b42ece8bab7a.zip
Revert misguided change to postgres_fdw FOR UPDATE/SHARE code.
In commit 462bd95705a0c23ba0b0ba60a78d32566a0384c1, I changed postgres_fdw to rely on get_plan_rowmark() instead of get_parse_rowmark(). I still think that's a good idea in the long run, but as Etsuro Fujita pointed out, it doesn't work today because planner.c forces PlanRowMarks to have markType = ROW_MARK_COPY for all foreign tables. There's no urgent reason to change this in the back branches, so let's just revert that part of yesterday's commit rather than trying to design a better solution under time pressure. Also, add a regression test case showing what postgres_fdw does with FOR UPDATE/SHARE. I'd blithely assumed there was one already, else I'd have realized yesterday that this code didn't work.
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
-rw-r--r--contrib/postgres_fdw/postgres_fdw.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/contrib/postgres_fdw/postgres_fdw.c b/contrib/postgres_fdw/postgres_fdw.c
index 0d629e6687b..10a21cd96d5 100644
--- a/contrib/postgres_fdw/postgres_fdw.c
+++ b/contrib/postgres_fdw/postgres_fdw.c
@@ -819,7 +819,7 @@ postgresGetForeignPlan(PlannerInfo *root,
}
else
{
- PlanRowMark *rc = get_plan_rowmark(root->rowMarks, baserel->relid);
+ RowMarkClause *rc = get_parse_rowmark(root->parse, baserel->relid);
if (rc)
{
@@ -832,18 +832,15 @@ postgresGetForeignPlan(PlannerInfo *root,
* complete information about, and (b) it wouldn't work anyway on
* older remote servers. Likewise, we don't worry about NOWAIT.
*/
- switch (rc->markType)
+ switch (rc->strength)
{
- case ROW_MARK_EXCLUSIVE:
- case ROW_MARK_NOKEYEXCLUSIVE:
- appendStringInfoString(&sql, " FOR UPDATE");
- break;
- case ROW_MARK_SHARE:
- case ROW_MARK_KEYSHARE:
+ case LCS_FORKEYSHARE:
+ case LCS_FORSHARE:
appendStringInfoString(&sql, " FOR SHARE");
break;
- default:
- /* nothing needed */
+ case LCS_FORNOKEYUPDATE:
+ case LCS_FORUPDATE:
+ appendStringInfoString(&sql, " FOR UPDATE");
break;
}
}