Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite5fe2e8

Browse files
committed
Recognize RETURN QUERY via a textual test, so that QUERY doesn't need to be
a plpgsql keyword. This avoids springing a new reserved word on plpgsqlprogrammers.For consistency, handle RETURN NEXT the same way.
1 parent4521207 commite5fe2e8

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

‎src/pl/plpgsql/src/gram.y

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.105 2007/07/25 04:19:08 neilc Exp $
12+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.106 2007/11/09 23:58:32 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -181,14 +181,12 @@ staticvoid check_labels(const char *start_label,
181181
%tokenK_LOG
182182
%tokenK_LOOP
183183
%tokenK_MOVE
184-
%tokenK_NEXT
185184
%tokenK_NOSCROLL
186185
%tokenK_NOT
187186
%tokenK_NOTICE
188187
%tokenK_NULL
189188
%tokenK_OPEN
190189
%tokenK_OR
191-
%tokenK_QUERY
192190
%tokenK_PERFORM
193191
%tokenK_ROW_COUNT
194192
%tokenK_RAISE
@@ -1169,11 +1167,19 @@ stmt_return: K_RETURN lno
11691167
inttok;
11701168

11711169
tok =yylex();
1172-
if (tok == K_NEXT)
1170+
if (tok ==0)
1171+
yyerror("unexpected end of function definition");
1172+
1173+
/*
1174+
* To avoid making NEXT and QUERY effectively be
1175+
* reserved words within plpgsql, recognize them
1176+
* via yytext.
1177+
*/
1178+
if (pg_strcasecmp(yytext,"next") ==0)
11731179
{
11741180
$$ = make_return_next_stmt($2);
11751181
}
1176-
elseif (tok==K_QUERY)
1182+
elseif (pg_strcasecmp(yytext,"query")==0)
11771183
{
11781184
$$ = make_return_query_stmt($2);
11791185
}

‎src/pl/plpgsql/src/scan.l

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.58 2007/07/25 04:19:09 neilc Exp $
12+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.59 2007/11/09 23:58:32 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -143,15 +143,13 @@ is{ return K_IS;}
143143
log{return K_LOG;}
144144
loop{return K_LOOP;}
145145
move{return K_MOVE;}
146-
next{return K_NEXT;}
147146
no{space}+scroll {return K_NOSCROLL;}
148147
not{return K_NOT;}
149148
notice{return K_NOTICE;}
150149
null{return K_NULL;}
151150
open{return K_OPEN;}
152151
or{return K_OR;}
153152
perform{return K_PERFORM;}
154-
query{return K_QUERY;}
155153
raise{return K_RAISE;}
156154
rename{return K_RENAME;}
157155
result_oid{return K_RESULT_OID;}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp