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

Commit443c08a

Browse files
Jan WieckJan Wieck
Jan Wieck
authored and
Jan Wieck
committed
Fixed shift/reduce conflict
SelectStmt and CursorStmt tried to parse FOR UPDATE ... / FOR READ ONLY.Cursor now checks that it is read only by looking at forUpdate of Query.SelectStmt handles FOR READ ONLY too.Jan
1 parent1f82f1d commit443c08a

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

‎src/backend/parser/gram.y

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.78 1999/05/19 17:53:10 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.79 1999/05/20 12:12:55 wieck Exp $
1414
*
1515
* HISTORY
1616
* AUTHORDATEMAJOR EVENT
@@ -196,7 +196,7 @@ Oidparam_type(int t); /* used in parse_expr.c */
196196

197197
%type <boolean> opt_inh_star, opt_binary, opt_instead, opt_with_copy,
198198
index_opt_unique, opt_verbose, opt_analyze
199-
%type <boolean>cursor_clause,opt_cursor, opt_readonly, opt_of
199+
%type <boolean> opt_cursor
200200

201201
%type <ival>copy_dirn, def_type, opt_direction, remove_type,
202202
opt_column, event
@@ -2646,7 +2646,7 @@ UpdateStmt: UPDATE relation_name
26462646
*
26472647
*****************************************************************************/
26482648
/***S*I***/
2649-
CursorStmt: DECLARE name opt_cursor CURSOR FOR SelectStmt cursor_clause
2649+
CursorStmt: DECLARE name opt_cursor CURSOR FOR SelectStmt
26502650
{
26512651
SelectStmt *n;
26522652

@@ -2664,6 +2664,9 @@ CursorStmt: DECLARE name opt_cursor CURSOR FOR SelectStmt cursor_clause
26642664

26652665
n->portalname = $2;
26662666
n->binary = $3;
2667+
if (n->forUpdate != NULL)
2668+
elog(ERROR,"DECLARE/UPDATE not supported;"
2669+
" Cursors must be READ ONLY.");
26672670
$$ = (Node *)n;
26682671
}
26692672
;
@@ -2675,24 +2678,6 @@ opt_cursor: BINARY{ $$ = TRUE; }
26752678
| /*EMPTY*/{ $$ = FALSE; }
26762679
;
26772680

2678-
cursor_clause: FOR opt_readonly{ $$ = $2; }
2679-
| /*EMPTY*/{ $$ = FALSE; }
2680-
;
2681-
2682-
opt_readonly: READ ONLY{ $$ = TRUE; }
2683-
| UPDATE opt_of
2684-
{
2685-
elog(ERROR,"DECLARE/UPDATE not supported;"
2686-
" Cursors must be READ ONLY.");
2687-
$$ = FALSE;
2688-
}
2689-
;
2690-
2691-
opt_of: OF columnList
2692-
{
2693-
$$ = FALSE;
2694-
}
2695-
26962681
/*****************************************************************************
26972682
*
26982683
*QUERY:
@@ -3007,6 +2992,7 @@ having_clause: HAVING a_expr
30072992
;
30082993

30092994
for_update_clause: FOR UPDATE update_list{ $$ = $3; }
2995+
| FOR READ ONLY{ $$ = NULL; }
30102996
| /* EMPTY */{ $$ = NULL; }
30112997
;
30122998

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp