1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-09 13:09:39 +03:00

Improve the representation of FOR UPDATE/FOR SHARE so that we can

support both FOR UPDATE and FOR SHARE in one command, as well as both
NOWAIT and normal WAIT behavior.  The more general code is actually
simpler and cleaner.
This commit is contained in:
Tom Lane
2006-04-30 18:30:40 +00:00
parent 931bfc9664
commit 986085a7f0
29 changed files with 320 additions and 245 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.98 2006/04/05 22:11:55 tgl Exp $
* $PostgreSQL: pgsql/src/backend/rewrite/rewriteManip.c,v 1.99 2006/04/30 18:30:39 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -240,7 +240,11 @@ OffsetVarNodes(Node *node, int offset, int sublevels_up)
if (qry->resultRelation)
qry->resultRelation += offset;
foreach(l, qry->rowMarks)
lfirst_int(l) += offset;
{
RowMarkClause *rc = (RowMarkClause *) lfirst(l);
rc->rti += offset;
}
}
query_tree_walker(qry, OffsetVarNodes_walker,
(void *) &context, 0);
@@ -395,8 +399,10 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
qry->resultRelation = new_index;
foreach(l, qry->rowMarks)
{
if (lfirst_int(l) == rt_index)
lfirst_int(l) = new_index;
RowMarkClause *rc = (RowMarkClause *) lfirst(l);
if (rc->rti == rt_index)
rc->rti = new_index;
}
}
query_tree_walker(qry, ChangeVarNodes_walker,