diff options
Diffstat (limited to 'src/backend/parser')
| -rw-r--r-- | src/backend/parser/analyze.c | 9 | ||||
| -rw-r--r-- | src/backend/parser/gram.y | 21 | ||||
| -rw-r--r-- | src/backend/parser/keywords.c | 3 |
3 files changed, 25 insertions, 8 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c index 3486a1e010b..64cd5603acd 100644 --- a/src/backend/parser/analyze.c +++ b/src/backend/parser/analyze.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.265 2003/03/10 03:53:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.266 2003/03/27 16:51:28 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -2294,6 +2294,13 @@ transformDeclareCursorStmt(ParseState *pstate, DeclareCursorStmt *stmt) result->commandType = CMD_UTILITY; result->utilityStmt = (Node *) stmt; + /* + * Don't allow both SCROLL and NO SCROLL to be specified + */ + if ((stmt->options & CURSOR_OPT_SCROLL) && + (stmt->options & CURSOR_OPT_NO_SCROLL)) + elog(ERROR, "Both SCROLL and NO SCROLL cannot be specified."); + stmt->query = (Node *) transformStmt(pstate, stmt->query, &extras_before, &extras_after); diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index dc8b06e7507..0ee065a9a11 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.408 2003/03/20 18:52:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.409 2003/03/27 16:51:28 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -246,7 +246,7 @@ static void doNegateFloat(Value *v); %type <boolean> opt_freeze opt_default opt_recheck %type <defelt> opt_binary opt_oids copy_delimiter -%type <boolean> copy_from +%type <boolean> copy_from opt_hold %type <ival> reindex_type drop_type fetch_count opt_column event comment_type cursor_options @@ -348,7 +348,7 @@ static void doNegateFloat(Value *v); GLOBAL GRANT GROUP_P - HANDLER HAVING HOUR_P + HANDLER HAVING HOLD HOUR_P ILIKE IMMEDIATE IMMUTABLE IMPLICIT_P IN_P INCREMENT INDEX INHERITS INITIALLY INNER_P INOUT INPUT @@ -4230,22 +4230,31 @@ UpdateStmt: UPDATE relation_expr * CURSOR STATEMENTS * *****************************************************************************/ -DeclareCursorStmt: DECLARE name cursor_options CURSOR FOR SelectStmt +DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt { DeclareCursorStmt *n = makeNode(DeclareCursorStmt); n->portalname = $2; n->options = $3; - n->query = $6; + n->query = $7; + + if ($5) + n->options |= CURSOR_OPT_HOLD; + $$ = (Node *)n; } ; cursor_options: /*EMPTY*/ { $$ = 0; } - | cursor_options BINARY { $$ = $1 | CURSOR_OPT_BINARY; } + | cursor_options NO SCROLL { $$ = $1 | CURSOR_OPT_NO_SCROLL; } | cursor_options SCROLL { $$ = $1 | CURSOR_OPT_SCROLL; } + | cursor_options BINARY { $$ = $1 | CURSOR_OPT_BINARY; } | cursor_options INSENSITIVE { $$ = $1 | CURSOR_OPT_INSENSITIVE; } ; +opt_hold: /* EMPTY */ { $$ = FALSE; } + | WITH HOLD { $$ = TRUE; } + | WITHOUT HOLD { $$ = FALSE; } + /***************************************************************************** * * QUERY: diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c index 83608d95edb..d62f5668d5d 100644 --- a/src/backend/parser/keywords.c +++ b/src/backend/parser/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.136 2003/03/20 07:02:10 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.137 2003/03/27 16:51:28 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -143,6 +143,7 @@ static const ScanKeyword ScanKeywords[] = { {"group", GROUP_P}, {"handler", HANDLER}, {"having", HAVING}, + {"hold", HOLD}, {"hour", HOUR_P}, {"ilike", ILIKE}, {"immediate", IMMEDIATE}, |
