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

Commit0a844e8

Browse files
committed
transformForUpdate() mustn't assume rowMarks list is initially empty.
It could be recursing into a sub-query where there was already a FORUPDATE clause.
1 parent73d2a35 commit0a844e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

‎src/backend/parser/analyze.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
*$Id: analyze.c,v 1.171 2000/12/06 23:55:19 tgl Exp $
9+
*$Id: analyze.c,v 1.172 2000/12/07 01:12:08 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -2503,6 +2503,7 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt)
25032503
returnqry;
25042504
}
25052505

2506+
/* exported so planner can check again after rewriting, query pullup, etc */
25062507
void
25072508
CheckSelectForUpdate(Query*qry)
25082509
{
@@ -2519,7 +2520,7 @@ CheckSelectForUpdate(Query *qry)
25192520
staticvoid
25202521
transformForUpdate(Query*qry,List*forUpdate)
25212522
{
2522-
List*rowMarks=NIL;
2523+
List*rowMarks=qry->rowMarks;
25232524
List*l;
25242525
List*rt;
25252526
Indexi;
@@ -2542,7 +2543,8 @@ transformForUpdate(Query *qry, List *forUpdate)
25422543
}
25432544
else
25442545
{
2545-
rowMarks=lappendi(rowMarks,i);
2546+
if (!intMember(i,rowMarks))/* avoid duplicates */
2547+
rowMarks=lappendi(rowMarks,i);
25462548
rte->checkForWrite= true;
25472549
}
25482550
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp