mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
Expose more cursor-related functionality in SPI: specifically, allow
access to the planner's cursor-related planning options, and provide new FETCH/MOVE routines that allow access to the full power of those commands. Small refactoring of planner(), pg_plan_query(), and pg_plan_queries() APIs to make it convenient to pass the planning options down from SPI. This is the core-code portion of Pavel Stehule's patch for scrollable cursor support in plpgsql; I'll review and apply the plpgsql changes separately.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.588 2007/04/12 06:53:46 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.589 2007/04/16 01:14:56 tgl Exp $
|
||||
*
|
||||
* HISTORY
|
||||
* AUTHOR DATE MAJOR EVENT
|
||||
@@ -279,9 +279,9 @@ static Node *makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args)
|
||||
%type <boolean> opt_freeze opt_default opt_recheck
|
||||
%type <defelt> opt_binary opt_oids copy_delimiter
|
||||
|
||||
%type <boolean> copy_from opt_hold
|
||||
%type <boolean> copy_from
|
||||
|
||||
%type <ival> opt_column event cursor_options
|
||||
%type <ival> opt_column event cursor_options opt_hold
|
||||
%type <objtype> reindex_type drop_type comment_type
|
||||
|
||||
%type <node> fetch_direction select_limit_value select_offset_value
|
||||
@@ -5821,10 +5821,9 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
|
||||
{
|
||||
DeclareCursorStmt *n = makeNode(DeclareCursorStmt);
|
||||
n->portalname = $2;
|
||||
n->options = $3;
|
||||
/* currently we always set FAST_PLAN option */
|
||||
n->options = $3 | $5 | CURSOR_OPT_FAST_PLAN;
|
||||
n->query = $7;
|
||||
if ($5)
|
||||
n->options |= CURSOR_OPT_HOLD;
|
||||
$$ = (Node *)n;
|
||||
}
|
||||
;
|
||||
@@ -5836,9 +5835,9 @@ cursor_options: /*EMPTY*/ { $$ = 0; }
|
||||
| cursor_options INSENSITIVE { $$ = $1 | CURSOR_OPT_INSENSITIVE; }
|
||||
;
|
||||
|
||||
opt_hold: /* EMPTY */ { $$ = FALSE; }
|
||||
| WITH HOLD { $$ = TRUE; }
|
||||
| WITHOUT HOLD { $$ = FALSE; }
|
||||
opt_hold: /* EMPTY */ { $$ = 0; }
|
||||
| WITH HOLD { $$ = CURSOR_OPT_HOLD; }
|
||||
| WITHOUT HOLD { $$ = 0; }
|
||||
;
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user