Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2481825

Browse files
committed
Current implementation of FOR UPDATE has no hope of working correctly
for relations on the nullable side of an OUTER JOIN. For now I thinkwe'd better refuse such queries.
1 parent7d802e0 commit2481825

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

‎src/backend/optimizer/plan/initsplan.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.60 2001/05/07 00:43:21 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/plan/initsplan.c,v 1.61 2001/05/14 20:25:00 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -298,14 +298,30 @@ mark_baserels_for_outer_join(Query *root, Relids rels, Relids outerrels)
298298

299299
foreach(relid,rels)
300300
{
301-
RelOptInfo*rel=get_base_rel(root,lfirsti(relid));
301+
intrelno=lfirsti(relid);
302+
RelOptInfo*rel=get_base_rel(root,relno);
302303

303304
/*
304305
* Since we do this bottom-up, any outer-rels previously marked
305306
* should be within the new outer join set.
306307
*/
307308
Assert(is_subseti(rel->outerjoinset,outerrels));
308309

310+
/*
311+
* Presently the executor cannot support FOR UPDATE marking of
312+
* rels appearing on the nullable side of an outer join.
313+
* (It's somewhat unclear what that would mean, anyway: what should
314+
* we mark when a result row is generated from no element of the
315+
* nullable relation?) So, complain if target rel is FOR UPDATE.
316+
* It's sufficient to make this check once per rel, so do it only
317+
* if rel wasn't already known nullable.
318+
*/
319+
if (rel->outerjoinset==NIL)
320+
{
321+
if (intMember(relno,root->rowMarks))
322+
elog(ERROR,"SELECT FOR UPDATE cannot be applied to the nullable side of an OUTER JOIN");
323+
}
324+
309325
rel->outerjoinset=outerrels;
310326
}
311327
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp