11
11
*
12
12
*
13
13
* IDENTIFICATION
14
- * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.691 2009/11/11 19:25:40 alvherre Exp $
14
+ * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.692 2009/11/11 20:31:26 alvherre Exp $
15
15
*
16
16
* HISTORY
17
17
* AUTHOR DATE MAJOR EVENT
@@ -251,7 +251,7 @@ static TypeName *TableFuncTypeName(List *columns);
251
251
252
252
%type <str> copy_file_name
253
253
database_name access_method_clause access_method attr_name
254
- index_name name file_name cluster_index_specification
254
+ index_name name cursor_name file_name cluster_index_specification
255
255
256
256
%type <list> func_name handler_name qual_Op qual_all_Op subquery_Op
257
257
opt_class opt_inline_handler opt_validator validator_clause
@@ -1941,7 +1941,7 @@ reloption_elem:
1941
1941
*****************************************************************************/
1942
1942
1943
1943
ClosePortalStmt :
1944
- CLOSE name
1944
+ CLOSE cursor_name
1945
1945
{
1946
1946
ClosePortalStmt *n = makeNode(ClosePortalStmt);
1947
1947
n->portalname = $2 ;
@@ -4194,127 +4194,127 @@ FetchStmt: FETCH fetch_args
4194
4194
}
4195
4195
;
4196
4196
4197
- fetch_args: name
4197
+ fetch_args: cursor_name
4198
4198
{
4199
4199
FetchStmt *n = makeNode(FetchStmt);
4200
4200
n->portalname = $1 ;
4201
4201
n->direction = FETCH_FORWARD;
4202
4202
n->howMany = 1 ;
4203
4203
$$ = (Node *)n;
4204
4204
}
4205
- | from_in name
4205
+ | from_in cursor_name
4206
4206
{
4207
4207
FetchStmt *n = makeNode(FetchStmt);
4208
4208
n->portalname = $2 ;
4209
4209
n->direction = FETCH_FORWARD;
4210
4210
n->howMany = 1 ;
4211
4211
$$ = (Node *)n;
4212
4212
}
4213
- | NEXT opt_from_in name
4213
+ | NEXT opt_from_in cursor_name
4214
4214
{
4215
4215
FetchStmt *n = makeNode(FetchStmt);
4216
4216
n->portalname = $3 ;
4217
4217
n->direction = FETCH_FORWARD;
4218
4218
n->howMany = 1 ;
4219
4219
$$ = (Node *)n;
4220
4220
}
4221
- | PRIOR opt_from_in name
4221
+ | PRIOR opt_from_in cursor_name
4222
4222
{
4223
4223
FetchStmt *n = makeNode(FetchStmt);
4224
4224
n->portalname = $3 ;
4225
4225
n->direction = FETCH_BACKWARD;
4226
4226
n->howMany = 1 ;
4227
4227
$$ = (Node *)n;
4228
4228
}
4229
- | FIRST_P opt_from_in name
4229
+ | FIRST_P opt_from_in cursor_name
4230
4230
{
4231
4231
FetchStmt *n = makeNode(FetchStmt);
4232
4232
n->portalname = $3 ;
4233
4233
n->direction = FETCH_ABSOLUTE;
4234
4234
n->howMany = 1 ;
4235
4235
$$ = (Node *)n;
4236
4236
}
4237
- | LAST_P opt_from_in name
4237
+ | LAST_P opt_from_in cursor_name
4238
4238
{
4239
4239
FetchStmt *n = makeNode(FetchStmt);
4240
4240
n->portalname = $3 ;
4241
4241
n->direction = FETCH_ABSOLUTE;
4242
4242
n->howMany = -1 ;
4243
4243
$$ = (Node *)n;
4244
4244
}
4245
- | ABSOLUTE_P SignedIconst opt_from_in name
4245
+ | ABSOLUTE_P SignedIconst opt_from_in cursor_name
4246
4246
{
4247
4247
FetchStmt *n = makeNode(FetchStmt);
4248
4248
n->portalname = $4 ;
4249
4249
n->direction = FETCH_ABSOLUTE;
4250
4250
n->howMany = $2 ;
4251
4251
$$ = (Node *)n;
4252
4252
}
4253
- | RELATIVE_P SignedIconst opt_from_in name
4253
+ | RELATIVE_P SignedIconst opt_from_in cursor_name
4254
4254
{
4255
4255
FetchStmt *n = makeNode(FetchStmt);
4256
4256
n->portalname = $4 ;
4257
4257
n->direction = FETCH_RELATIVE;
4258
4258
n->howMany = $2 ;
4259
4259
$$ = (Node *)n;
4260
4260
}
4261
- | SignedIconst opt_from_in name
4261
+ | SignedIconst opt_from_in cursor_name
4262
4262
{
4263
4263
FetchStmt *n = makeNode(FetchStmt);
4264
4264
n->portalname = $3 ;
4265
4265
n->direction = FETCH_FORWARD;
4266
4266
n->howMany = $1 ;
4267
4267
$$ = (Node *)n;
4268
4268
}
4269
- | ALL opt_from_in name
4269
+ | ALL opt_from_in cursor_name
4270
4270
{
4271
4271
FetchStmt *n = makeNode(FetchStmt);
4272
4272
n->portalname = $3 ;
4273
4273
n->direction = FETCH_FORWARD;
4274
4274
n->howMany = FETCH_ALL;
4275
4275
$$ = (Node *)n;
4276
4276
}
4277
- | FORWARD opt_from_in name
4277
+ | FORWARD opt_from_in cursor_name
4278
4278
{
4279
4279
FetchStmt *n = makeNode(FetchStmt);
4280
4280
n->portalname = $3 ;
4281
4281
n->direction = FETCH_FORWARD;
4282
4282
n->howMany = 1 ;
4283
4283
$$ = (Node *)n;
4284
4284
}
4285
- | FORWARD SignedIconst opt_from_in name
4285
+ | FORWARD SignedIconst opt_from_in cursor_name
4286
4286
{
4287
4287
FetchStmt *n = makeNode(FetchStmt);
4288
4288
n->portalname = $4 ;
4289
4289
n->direction = FETCH_FORWARD;
4290
4290
n->howMany = $2 ;
4291
4291
$$ = (Node *)n;
4292
4292
}
4293
- | FORWARD ALL opt_from_in name
4293
+ | FORWARD ALL opt_from_in cursor_name
4294
4294
{
4295
4295
FetchStmt *n = makeNode(FetchStmt);
4296
4296
n->portalname = $4 ;
4297
4297
n->direction = FETCH_FORWARD;
4298
4298
n->howMany = FETCH_ALL;
4299
4299
$$ = (Node *)n;
4300
4300
}
4301
- | BACKWARD opt_from_in name
4301
+ | BACKWARD opt_from_in cursor_name
4302
4302
{
4303
4303
FetchStmt *n = makeNode(FetchStmt);
4304
4304
n->portalname = $3 ;
4305
4305
n->direction = FETCH_BACKWARD;
4306
4306
n->howMany = 1 ;
4307
4307
$$ = (Node *)n;
4308
4308
}
4309
- | BACKWARD SignedIconst opt_from_in name
4309
+ | BACKWARD SignedIconst opt_from_in cursor_name
4310
4310
{
4311
4311
FetchStmt *n = makeNode(FetchStmt);
4312
4312
n->portalname = $4 ;
4313
4313
n->direction = FETCH_BACKWARD;
4314
4314
n->howMany = $2 ;
4315
4315
$$ = (Node *)n;
4316
4316
}
4317
- | BACKWARD ALL opt_from_in name
4317
+ | BACKWARD ALL opt_from_in cursor_name
4318
4318
{
4319
4319
FetchStmt *n = makeNode(FetchStmt);
4320
4320
n->portalname = $4 ;
@@ -7108,7 +7108,7 @@ set_target_list:
7108
7108
* CURSOR STATEMENTS
7109
7109
*
7110
7110
*****************************************************************************/
7111
- DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
7111
+ DeclareCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR SelectStmt
7112
7112
{
7113
7113
DeclareCursorStmt *n = makeNode(DeclareCursorStmt);
7114
7114
n->portalname = $2 ;
@@ -7119,6 +7119,9 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
7119
7119
}
7120
7120
;
7121
7121
7122
+ cursor_name: name { $$ = $1 ; }
7123
+ ;
7124
+
7122
7125
cursor_options: /* EMPTY*/ { $$ = 0 ; }
7123
7126
| cursor_options NO SCROLL { $$ = $1 | CURSOR_OPT_NO_SCROLL; }
7124
7127
| cursor_options SCROLL { $$ = $1 | CURSOR_OPT_SCROLL; }
0 commit comments