From: Jan Wieck Date: Thu, 20 May 1999 12:12:55 +0000 (+0000) Subject: Fixed shift/reduce conflict X-Git-Url: http://waps.l3s.uni-hannover.de/gitweb/?a=commitdiff_plain;h=95b5a79f158342360eaa63b27edcbd84bfa1dadf;p=users%2Fbernd%2Fpostgres.git 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 --- diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 3f4686888e..e96bf583f0 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -196,7 +196,7 @@ Oid param_type(int t); /* used in parse_expr.c */ %type opt_inh_star, opt_binary, opt_instead, opt_with_copy, index_opt_unique, opt_verbose, opt_analyze -%type cursor_clause, opt_cursor, opt_readonly, opt_of +%type opt_cursor %type copy_dirn, def_type, opt_direction, remove_type, opt_column, event @@ -2646,7 +2646,7 @@ UpdateStmt: UPDATE relation_name * *****************************************************************************/ /***S*I***/ -CursorStmt: DECLARE name opt_cursor CURSOR FOR SelectStmt cursor_clause +CursorStmt: DECLARE name opt_cursor CURSOR FOR SelectStmt { SelectStmt *n; @@ -2664,6 +2664,9 @@ CursorStmt: DECLARE name opt_cursor CURSOR FOR SelectStmt cursor_clause n->portalname = $2; n->binary = $3; + if (n->forUpdate != NULL) + elog(ERROR,"DECLARE/UPDATE not supported;" + " Cursors must be READ ONLY."); $$ = (Node *)n; } ; @@ -2675,24 +2678,6 @@ opt_cursor: BINARY { $$ = TRUE; } | /*EMPTY*/ { $$ = FALSE; } ; -cursor_clause: FOR opt_readonly { $$ = $2; } - | /*EMPTY*/ { $$ = FALSE; } - ; - -opt_readonly: READ ONLY { $$ = TRUE; } - | UPDATE opt_of - { - elog(ERROR,"DECLARE/UPDATE not supported;" - " Cursors must be READ ONLY."); - $$ = FALSE; - } - ; - -opt_of: OF columnList - { - $$ = FALSE; - } - /***************************************************************************** * * QUERY: @@ -3007,6 +2992,7 @@ having_clause: HAVING a_expr ; for_update_clause: FOR UPDATE update_list { $$ = $3; } + | FOR READ ONLY { $$ = NULL; } | /* EMPTY */ { $$ = NULL; } ;