*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.691 2009/11/11 19:25:40 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.692 2009/11/11 20:31:26 alvherre Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
%type <str> copy_file_name
database_name access_method_clause access_method attr_name
- index_name name file_name cluster_index_specification
+ index_name name cursor_name file_name cluster_index_specification
%type <list> func_name handler_name qual_Op qual_all_Op subquery_Op
opt_class opt_inline_handler opt_validator validator_clause
*****************************************************************************/
ClosePortalStmt:
- CLOSE name
+ CLOSE cursor_name
{
ClosePortalStmt *n = makeNode(ClosePortalStmt);
n->portalname = $2;
}
;
-fetch_args: name
+fetch_args: cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $1;
n->howMany = 1;
$$ = (Node *)n;
}
- | from_in name
+ | from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $2;
n->howMany = 1;
$$ = (Node *)n;
}
- | NEXT opt_from_in name
+ | NEXT opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->howMany = 1;
$$ = (Node *)n;
}
- | PRIOR opt_from_in name
+ | PRIOR opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->howMany = 1;
$$ = (Node *)n;
}
- | FIRST_P opt_from_in name
+ | FIRST_P opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->howMany = 1;
$$ = (Node *)n;
}
- | LAST_P opt_from_in name
+ | LAST_P opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->howMany = -1;
$$ = (Node *)n;
}
- | ABSOLUTE_P SignedIconst opt_from_in name
+ | ABSOLUTE_P SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
n->howMany = $2;
$$ = (Node *)n;
}
- | RELATIVE_P SignedIconst opt_from_in name
+ | RELATIVE_P SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
n->howMany = $2;
$$ = (Node *)n;
}
- | SignedIconst opt_from_in name
+ | SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->howMany = $1;
$$ = (Node *)n;
}
- | ALL opt_from_in name
+ | ALL opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->howMany = FETCH_ALL;
$$ = (Node *)n;
}
- | FORWARD opt_from_in name
+ | FORWARD opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->howMany = 1;
$$ = (Node *)n;
}
- | FORWARD SignedIconst opt_from_in name
+ | FORWARD SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
n->howMany = $2;
$$ = (Node *)n;
}
- | FORWARD ALL opt_from_in name
+ | FORWARD ALL opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
n->howMany = FETCH_ALL;
$$ = (Node *)n;
}
- | BACKWARD opt_from_in name
+ | BACKWARD opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $3;
n->howMany = 1;
$$ = (Node *)n;
}
- | BACKWARD SignedIconst opt_from_in name
+ | BACKWARD SignedIconst opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
n->howMany = $2;
$$ = (Node *)n;
}
- | BACKWARD ALL opt_from_in name
+ | BACKWARD ALL opt_from_in cursor_name
{
FetchStmt *n = makeNode(FetchStmt);
n->portalname = $4;
* CURSOR STATEMENTS
*
*****************************************************************************/
-DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
+DeclareCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR SelectStmt
{
DeclareCursorStmt *n = makeNode(DeclareCursorStmt);
n->portalname = $2;
}
;
+cursor_name: name { $$ = $1; }
+ ;
+
cursor_options: /*EMPTY*/ { $$ = 0; }
| cursor_options NO SCROLL { $$ = $1 | CURSOR_OPT_NO_SCROLL; }
| cursor_options SCROLL { $$ = $1 | CURSOR_OPT_SCROLL; }
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.7 2009/11/11 19:25:40 alvherre Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.8 2009/11/11 20:31:26 alvherre Exp $ */
ECPG: stmtClosePortalStmt block
{
free($1);
$1 = make_str("$0");
}
-ECPG: fetch_argsname addon
+ECPG: fetch_argscursor_name addon
add_additional_variables($1, false);
-ECPG: fetch_argsfrom_inname addon
+ECPG: fetch_argsfrom_incursor_name addon
add_additional_variables($2, false);
-ECPG: fetch_argsNEXTopt_from_inname addon
-ECPG: fetch_argsPRIORopt_from_inname addon
-ECPG: fetch_argsFIRST_Popt_from_inname addon
-ECPG: fetch_argsLAST_Popt_from_inname addon
-ECPG: fetch_argsALLopt_from_inname addon
-ECPG: fetch_argsFORWARDopt_from_inname addon
-ECPG: fetch_argsBACKWARDopt_from_inname addon
+ECPG: fetch_argsNEXTopt_from_incursor_name addon
+ECPG: fetch_argsPRIORopt_from_incursor_name addon
+ECPG: fetch_argsFIRST_Popt_from_incursor_name addon
+ECPG: fetch_argsLAST_Popt_from_incursor_name addon
+ECPG: fetch_argsALLopt_from_incursor_name addon
+ECPG: fetch_argsFORWARDopt_from_incursor_name addon
+ECPG: fetch_argsBACKWARDopt_from_incursor_name addon
add_additional_variables($3, false);
-ECPG: fetch_argsSignedIconstopt_from_inname addon
+ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
add_additional_variables($3, false);
if ($1[0] == '$')
{
free($1);
$1 = make_str("$0");
}
-ECPG: fetch_argsFORWARDALLopt_from_inname addon
-ECPG: fetch_argsBACKWARDALLopt_from_inname addon
+ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon
+ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
add_additional_variables($4, false);
-ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_inname addon
-ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_inname addon
-ECPG: fetch_argsFORWARDSignedIconstopt_from_inname addon
-ECPG: fetch_argsBACKWARDSignedIconstopt_from_inname addon
+ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon
+ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon
+ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon
+ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon
add_additional_variables($4, false);
if ($2[0] == '$')
{
}
ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
{ $$ = $2; }
-ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt block
+ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
{
struct cursor *ptr, *this;
char *comment;
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.13 2009/11/05 23:24:27 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.14 2009/11/11 20:31:26 alvherre Exp $ */
statements: /*EMPTY*/
| statements statement
* Declare a prepared cursor. The syntax is different from the standard
* declare statement, so we create a new rule.
*/
-ECPGCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR prepared_name
+ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name
{
struct cursor *ptr, *this;
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
/*
* open is an open cursor, at the moment this has to be removed
*/
-ECPGOpen: SQL_OPEN name opt_ecpg_using { $$ = $2; };
+ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using { $$ = $2; };
opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; }
| ecpg_using { $$ = $1; }