aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-09-08 17:49:13 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-09-08 17:49:13 +0000
commitd09e79deb97baa0609203f5815005545f3e280a7 (patch)
tree625bdbbfa2f45d85eba82667033944bd26f2b6e8 /src
parentb59d31c21571995ca717c29eabd4022f35c35169 (diff)
downloadpostgresql-d09e79deb97baa0609203f5815005545f3e280a7.tar.gz
postgresql-d09e79deb97baa0609203f5815005545f3e280a7.zip
Put back plan-time check for trying to apply SELECT FOR UPDATE/SHARE
to a relation on the nullable side of an outer join. I had removed this during the outer join planning rewrite a few months ago ... I think I intended to put it somewhere else, but forgot ...
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/plan/initsplan.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/initsplan.c b/src/backend/optimizer/plan/initsplan.c
index 2f1fc953d1c..c2a1d3e080b 100644
--- a/src/backend/optimizer/plan/initsplan.c
+++ b/src/backend/optimizer/plan/initsplan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.120 2006/07/14 14:52:20 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.121 2006/09/08 17:49:13 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -446,6 +446,29 @@ make_outerjoininfo(PlannerInfo *root,
Relids strict_relids;
ListCell *l;
+ /*
+ * Presently the executor cannot support FOR UPDATE/SHARE marking of rels
+ * appearing on the nullable side of an outer join. (It's somewhat unclear
+ * what that would mean, anyway: what should we mark when a result row is
+ * generated from no element of the nullable relation?) So, complain if
+ * any nullable rel is FOR UPDATE/SHARE.
+ *
+ * You might be wondering why this test isn't made far upstream in the
+ * parser. It's because the parser hasn't got enough info --- consider
+ * FOR UPDATE applied to a view. Only after rewriting and flattening
+ * do we know whether the view contains an outer join.
+ */
+ foreach(l, root->parse->rowMarks)
+ {
+ RowMarkClause *rc = (RowMarkClause *) lfirst(l);
+
+ if (bms_is_member(rc->rti, right_rels) ||
+ (is_full_join && bms_is_member(rc->rti, left_rels)))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("SELECT FOR UPDATE/SHARE cannot be applied to the nullable side of an outer join")));
+ }
+
/* If it's a full join, no need to be very smart */
ojinfo->is_full_join = is_full_join;
if (is_full_join)