Skip to content

Commit d09e79d

Browse files
committed
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 ...
1 parent b59d31c commit d09e79d

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

src/backend/optimizer/plan/initsplan.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.120 2006/07/14 14:52:20 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/plan/initsplan.c,v 1.121 2006/09/08 17:49:13 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -446,6 +446,29 @@ make_outerjoininfo(PlannerInfo *root,
446446
Relids strict_relids;
447447
ListCell *l;
448448

449+
/*
450+
* Presently the executor cannot support FOR UPDATE/SHARE marking of rels
451+
* appearing on the nullable side of an outer join. (It's somewhat unclear
452+
* what that would mean, anyway: what should we mark when a result row is
453+
* generated from no element of the nullable relation?) So, complain if
454+
* any nullable rel is FOR UPDATE/SHARE.
455+
*
456+
* You might be wondering why this test isn't made far upstream in the
457+
* parser. It's because the parser hasn't got enough info --- consider
458+
* FOR UPDATE applied to a view. Only after rewriting and flattening
459+
* do we know whether the view contains an outer join.
460+
*/
461+
foreach(l, root->parse->rowMarks)
462+
{
463+
RowMarkClause *rc = (RowMarkClause *) lfirst(l);
464+
465+
if (bms_is_member(rc->rti, right_rels) ||
466+
(is_full_join && bms_is_member(rc->rti, left_rels)))
467+
ereport(ERROR,
468+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
469+
errmsg("SELECT FOR UPDATE/SHARE cannot be applied to the nullable side of an outer join")));
470+
}
471+
449472
/* If it's a full join, no need to be very smart */
450473
ojinfo->is_full_join = is_full_join;
451474
if (is_full_join)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy