1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +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

@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.334 2006/04/22 01:25:58 tgl Exp $
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.335 2006/04/30 18:30:38 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1409,6 +1409,18 @@ _copyGroupClause(GroupClause *from)
return newnode;
}
static RowMarkClause *
_copyRowMarkClause(RowMarkClause *from)
{
RowMarkClause *newnode = makeNode(RowMarkClause);
COPY_SCALAR_FIELD(rti);
COPY_SCALAR_FIELD(forUpdate);
COPY_SCALAR_FIELD(noWait);
return newnode;
}
static A_Expr *
_copyAExpr(A_Expr *from)
{
@@ -1650,7 +1662,7 @@ _copyLockingClause(LockingClause *from)
COPY_NODE_FIELD(lockedRels);
COPY_SCALAR_FIELD(forUpdate);
COPY_SCALAR_FIELD(nowait);
COPY_SCALAR_FIELD(noWait);
return newnode;
}
@@ -1673,9 +1685,6 @@ _copyQuery(Query *from)
COPY_SCALAR_FIELD(hasSubLinks);
COPY_NODE_FIELD(rtable);
COPY_NODE_FIELD(jointree);
COPY_NODE_FIELD(rowMarks);
COPY_SCALAR_FIELD(forUpdate);
COPY_SCALAR_FIELD(rowNoWait);
COPY_NODE_FIELD(targetList);
COPY_NODE_FIELD(groupClause);
COPY_NODE_FIELD(havingQual);
@@ -1683,6 +1692,7 @@ _copyQuery(Query *from)
COPY_NODE_FIELD(sortClause);
COPY_NODE_FIELD(limitOffset);
COPY_NODE_FIELD(limitCount);
COPY_NODE_FIELD(rowMarks);
COPY_NODE_FIELD(setOperations);
COPY_NODE_FIELD(resultRelations);
@@ -3284,6 +3294,9 @@ copyObject(void *from)
case T_GroupClause:
retval = _copyGroupClause(from);
break;
case T_RowMarkClause:
retval = _copyRowMarkClause(from);
break;
case T_FkConstraint:
retval = _copyFkConstraint(from);
break;