mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Support UPDATE/DELETE WHERE CURRENT OF cursor_name, per SQL standard.
Along the way, allow FOR UPDATE in non-WITH-HOLD cursors; there may once have been a reason to disallow that, but it seems to work now, and it's really rather necessary if you want to select a row via a cursor and then update it in a concurrent-safe fashion. Original patch by Arul Shaji, rather heavily editorialized by Tom Lane.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.207 2007/06/05 21:31:04 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/readfuncs.c,v 1.208 2007/06/11 01:16:22 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Path and Plan nodes do not have any readfuncs support, because we
|
||||
@ -873,6 +873,20 @@ _readSetToDefault(void)
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readCurrentOfExpr
|
||||
*/
|
||||
static CurrentOfExpr *
|
||||
_readCurrentOfExpr(void)
|
||||
{
|
||||
READ_LOCALS(CurrentOfExpr);
|
||||
|
||||
READ_UINT_FIELD(cvarno);
|
||||
READ_STRING_FIELD(cursor_name);
|
||||
|
||||
READ_DONE();
|
||||
}
|
||||
|
||||
/*
|
||||
* _readTargetEntry
|
||||
*/
|
||||
@ -1093,6 +1107,8 @@ parseNodeString(void)
|
||||
return_value = _readCoerceToDomainValue();
|
||||
else if (MATCH("SETTODEFAULT", 12))
|
||||
return_value = _readSetToDefault();
|
||||
else if (MATCH("CURRENTOFEXPR", 13))
|
||||
return_value = _readCurrentOfExpr();
|
||||
else if (MATCH("TARGETENTRY", 11))
|
||||
return_value = _readTargetEntry();
|
||||
else if (MATCH("RANGETBLREF", 11))
|
||||
|
Reference in New Issue
Block a user