mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +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:
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.259 2007/06/05 21:31:06 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.260 2007/06/11 01:16:29 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -3086,6 +3086,7 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags)
|
||||
case T_Param:
|
||||
case T_CoerceToDomainValue:
|
||||
case T_SetToDefault:
|
||||
case T_CurrentOfExpr:
|
||||
/* single words: always simple */
|
||||
return true;
|
||||
|
||||
@ -4134,6 +4135,11 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
appendStringInfo(buf, "DEFAULT");
|
||||
break;
|
||||
|
||||
case T_CurrentOfExpr:
|
||||
appendStringInfo(buf, "CURRENT OF %s",
|
||||
quote_identifier(((CurrentOfExpr *) node)->cursor_name));
|
||||
break;
|
||||
|
||||
case T_List:
|
||||
{
|
||||
char *sep;
|
||||
|
Reference in New Issue
Block a user