mirror of
https://github.com/postgres/postgres.git
synced 2025-11-16 15:02:33 +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:
@@ -10,7 +10,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.130 2007/06/05 21:31:08 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.131 2007/06/11 01:16:30 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -915,6 +915,21 @@ typedef struct SetToDefault
|
||||
int32 typeMod; /* typemod for substituted value */
|
||||
} SetToDefault;
|
||||
|
||||
/*
|
||||
* Node representing [WHERE] CURRENT OF cursor_name
|
||||
*
|
||||
* CURRENT OF is a bit like a Var, in that it carries the rangetable index
|
||||
* of the target relation being constrained; this aids placing the expression
|
||||
* correctly during planning. We can assume however that its "levelsup" is
|
||||
* always zero, due to the syntactic constraints on where it can appear.
|
||||
*/
|
||||
typedef struct CurrentOfExpr
|
||||
{
|
||||
Expr xpr;
|
||||
Index cvarno; /* RT index of target relation */
|
||||
char *cursor_name; /* name of referenced cursor */
|
||||
} CurrentOfExpr;
|
||||
|
||||
/*--------------------
|
||||
* TargetEntry -
|
||||
* a target entry (used in query target lists)
|
||||
|
||||
Reference in New Issue
Block a user