mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +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:
@@ -18,7 +18,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.308 2007/06/05 21:31:04 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.309 2007/06/11 01:16:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -598,6 +598,15 @@ _equalSetToDefault(SetToDefault *a, SetToDefault *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalCurrentOfExpr(CurrentOfExpr *a, CurrentOfExpr *b)
|
||||
{
|
||||
COMPARE_SCALAR_FIELD(cvarno);
|
||||
COMPARE_STRING_FIELD(cursor_name);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
_equalTargetEntry(TargetEntry *a, TargetEntry *b)
|
||||
{
|
||||
@@ -2124,6 +2133,9 @@ equal(void *a, void *b)
|
||||
case T_SetToDefault:
|
||||
retval = _equalSetToDefault(a, b);
|
||||
break;
|
||||
case T_CurrentOfExpr:
|
||||
retval = _equalCurrentOfExpr(a, b);
|
||||
break;
|
||||
case T_TargetEntry:
|
||||
retval = _equalTargetEntry(a, b);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user