mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +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:
@ -15,7 +15,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.377 2007/06/05 21:31:04 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.378 2007/06/11 01:16:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1299,6 +1299,20 @@ _copySetToDefault(SetToDefault *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyCurrentOfExpr
|
||||
*/
|
||||
static CurrentOfExpr *
|
||||
_copyCurrentOfExpr(CurrentOfExpr *from)
|
||||
{
|
||||
CurrentOfExpr *newnode = makeNode(CurrentOfExpr);
|
||||
|
||||
COPY_SCALAR_FIELD(cvarno);
|
||||
COPY_STRING_FIELD(cursor_name);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyTargetEntry
|
||||
*/
|
||||
@ -3177,6 +3191,9 @@ copyObject(void *from)
|
||||
case T_SetToDefault:
|
||||
retval = _copySetToDefault(from);
|
||||
break;
|
||||
case T_CurrentOfExpr:
|
||||
retval = _copyCurrentOfExpr(from);
|
||||
break;
|
||||
case T_TargetEntry:
|
||||
retval = _copyTargetEntry(from);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user