mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Add NOWAIT option to SELECT FOR UPDATE/SHARE.
Original patch by Hans-Juergen Schoenig, revisions by Karel Zak and Tom Lane.
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.314 2005/08/01 04:03:56 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.315 2005/08/01 20:31:08 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1589,6 +1589,18 @@ _copyDefElem(DefElem *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static LockingClause *
|
||||
_copyLockingClause(LockingClause *from)
|
||||
{
|
||||
LockingClause *newnode = makeNode(LockingClause);
|
||||
|
||||
COPY_NODE_FIELD(lockedRels);
|
||||
COPY_SCALAR_FIELD(forUpdate);
|
||||
COPY_SCALAR_FIELD(nowait);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static Query *
|
||||
_copyQuery(Query *from)
|
||||
{
|
||||
@ -1607,6 +1619,7 @@ _copyQuery(Query *from)
|
||||
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);
|
||||
@ -1675,8 +1688,7 @@ _copySelectStmt(SelectStmt *from)
|
||||
COPY_NODE_FIELD(sortClause);
|
||||
COPY_NODE_FIELD(limitOffset);
|
||||
COPY_NODE_FIELD(limitCount);
|
||||
COPY_NODE_FIELD(lockedRels);
|
||||
COPY_SCALAR_FIELD(forUpdate);
|
||||
COPY_NODE_FIELD(lockingClause);
|
||||
COPY_SCALAR_FIELD(op);
|
||||
COPY_SCALAR_FIELD(all);
|
||||
COPY_NODE_FIELD(larg);
|
||||
@ -3185,6 +3197,9 @@ copyObject(void *from)
|
||||
case T_DefElem:
|
||||
retval = _copyDefElem(from);
|
||||
break;
|
||||
case T_LockingClause:
|
||||
retval = _copyLockingClause(from);
|
||||
break;
|
||||
case T_RangeTblEntry:
|
||||
retval = _copyRangeTblEntry(from);
|
||||
break;
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.251 2005/08/01 04:03:56 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.252 2005/08/01 20:31:08 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -644,6 +644,7 @@ _equalQuery(Query *a, Query *b)
|
||||
COMPARE_NODE_FIELD(jointree);
|
||||
COMPARE_NODE_FIELD(rowMarks);
|
||||
COMPARE_SCALAR_FIELD(forUpdate);
|
||||
COMPARE_SCALAR_FIELD(rowNoWait);
|
||||
COMPARE_NODE_FIELD(targetList);
|
||||
COMPARE_NODE_FIELD(groupClause);
|
||||
COMPARE_NODE_FIELD(havingQual);
|
||||
@ -704,8 +705,7 @@ _equalSelectStmt(SelectStmt *a, SelectStmt *b)
|
||||
COMPARE_NODE_FIELD(sortClause);
|
||||
COMPARE_NODE_FIELD(limitOffset);
|
||||
COMPARE_NODE_FIELD(limitCount);
|
||||
COMPARE_NODE_FIELD(lockedRels);
|
||||
COMPARE_SCALAR_FIELD(forUpdate);
|
||||
COMPARE_NODE_FIELD(lockingClause);
|
||||
COMPARE_SCALAR_FIELD(op);
|
||||
COMPARE_SCALAR_FIELD(all);
|
||||
COMPARE_NODE_FIELD(larg);
|
||||
@ -1649,6 +1649,16 @@ _equalDefElem(DefElem *a, DefElem *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalLockingClause(LockingClause *a, LockingClause *b)
|
||||
{
|
||||
COMPARE_NODE_FIELD(lockedRels);
|
||||
COMPARE_SCALAR_FIELD(forUpdate);
|
||||
COMPARE_SCALAR_FIELD(nowait);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalRangeTblEntry(RangeTblEntry *a, RangeTblEntry *b)
|
||||
{
|
||||
@ -2229,6 +2239,9 @@ equal(void *a, void *b)
|
||||
case T_DefElem:
|
||||
retval = _equalDefElem(a, b);
|
||||
break;
|
||||
case T_LockingClause:
|
||||
retval = _equalLockingClause(a, b);
|
||||
break;
|
||||
case T_RangeTblEntry:
|
||||
retval = _equalRangeTblEntry(a, b);
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.258 2005/07/02 23:00:39 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.259 2005/08/01 20:31:08 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every node type that can appear in stored rules' parsetrees *must*
|
||||
@ -1343,8 +1343,7 @@ _outSelectStmt(StringInfo str, SelectStmt *node)
|
||||
WRITE_NODE_FIELD(sortClause);
|
||||
WRITE_NODE_FIELD(limitOffset);
|
||||
WRITE_NODE_FIELD(limitCount);
|
||||
WRITE_NODE_FIELD(lockedRels);
|
||||
WRITE_BOOL_FIELD(forUpdate);
|
||||
WRITE_NODE_FIELD(lockingClause);
|
||||
WRITE_ENUM_FIELD(op, SetOperation);
|
||||
WRITE_BOOL_FIELD(all);
|
||||
WRITE_NODE_FIELD(larg);
|
||||
@ -1371,6 +1370,16 @@ _outDefElem(StringInfo str, DefElem *node)
|
||||
WRITE_NODE_FIELD(arg);
|
||||
}
|
||||
|
||||
static void
|
||||
_outLockingClause(StringInfo str, LockingClause *node)
|
||||
{
|
||||
WRITE_NODE_TYPE("LOCKINGCLAUSE");
|
||||
|
||||
WRITE_NODE_FIELD(lockedRels);
|
||||
WRITE_BOOL_FIELD(forUpdate);
|
||||
WRITE_BOOL_FIELD(nowait);
|
||||
}
|
||||
|
||||
static void
|
||||
_outColumnDef(StringInfo str, ColumnDef *node)
|
||||
{
|
||||
@ -1462,6 +1471,7 @@ _outQuery(StringInfo str, Query *node)
|
||||
WRITE_NODE_FIELD(jointree);
|
||||
WRITE_NODE_FIELD(rowMarks);
|
||||
WRITE_BOOL_FIELD(forUpdate);
|
||||
WRITE_BOOL_FIELD(rowNoWait);
|
||||
WRITE_NODE_FIELD(targetList);
|
||||
WRITE_NODE_FIELD(groupClause);
|
||||
WRITE_NODE_FIELD(havingQual);
|
||||
@ -2079,6 +2089,9 @@ _outNode(StringInfo str, void *obj)
|
||||
case T_DefElem:
|
||||
_outDefElem(str, obj);
|
||||
break;
|
||||
case T_LockingClause:
|
||||
_outLockingClause(str, obj);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.180 2005/06/28 05:08:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.181 2005/08/01 20:31:08 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Path and Plan nodes do not have any readfuncs support, because we
|
||||
@ -146,6 +146,7 @@ _readQuery(void)
|
||||
READ_NODE_FIELD(jointree);
|
||||
READ_NODE_FIELD(rowMarks);
|
||||
READ_BOOL_FIELD(forUpdate);
|
||||
READ_BOOL_FIELD(rowNoWait);
|
||||
READ_NODE_FIELD(targetList);
|
||||
READ_NODE_FIELD(groupClause);
|
||||
READ_NODE_FIELD(havingQual);
|
||||
|
Reference in New Issue
Block a user