mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
transformForUpdate() mustn't assume rowMarks list is initially empty.
It could be recursing into a sub-query where there was already a FOR UPDATE clause.
This commit is contained in:
parent
73d2a3595a
commit
0a844e84a1
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: analyze.c,v 1.171 2000/12/06 23:55:19 tgl Exp $
|
* $Id: analyze.c,v 1.172 2000/12/07 01:12:08 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -2503,6 +2503,7 @@ transformAlterTableStmt(ParseState *pstate, AlterTableStmt *stmt)
|
|||||||
return qry;
|
return qry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* exported so planner can check again after rewriting, query pullup, etc */
|
||||||
void
|
void
|
||||||
CheckSelectForUpdate(Query *qry)
|
CheckSelectForUpdate(Query *qry)
|
||||||
{
|
{
|
||||||
@ -2519,7 +2520,7 @@ CheckSelectForUpdate(Query *qry)
|
|||||||
static void
|
static void
|
||||||
transformForUpdate(Query *qry, List *forUpdate)
|
transformForUpdate(Query *qry, List *forUpdate)
|
||||||
{
|
{
|
||||||
List *rowMarks = NIL;
|
List *rowMarks = qry->rowMarks;
|
||||||
List *l;
|
List *l;
|
||||||
List *rt;
|
List *rt;
|
||||||
Index i;
|
Index i;
|
||||||
@ -2542,6 +2543,7 @@ transformForUpdate(Query *qry, List *forUpdate)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (!intMember(i, rowMarks)) /* avoid duplicates */
|
||||||
rowMarks = lappendi(rowMarks, i);
|
rowMarks = lappendi(rowMarks, i);
|
||||||
rte->checkForWrite = true;
|
rte->checkForWrite = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user