Applied a patch by Zoltán Böszörményi that makes ecpg's parser accept dynamic cursorn...
authorMichael Meskes
Fri, 18 Feb 2011 10:16:16 +0000 (11:16 +0100)
committerMichael Meskes
Fri, 18 Feb 2011 10:16:16 +0000 (11:16 +0100)
src/backend/parser/gram.y
src/interfaces/ecpg/preproc/ecpg.addons

index 3857205ef9be92de76f2c2a794f0d8819e042862..077a10532eb7fb86a466e252bea3df403a03ff75 100644 (file)
@@ -9031,7 +9031,7 @@ where_clause:
 /* variant for UPDATE and DELETE */
 where_or_current_clause:
            WHERE a_expr                            { $$ = $2; }
-           | WHERE CURRENT_P OF name
+           | WHERE CURRENT_P OF cursor_name
                {
                    CurrentOfExpr *n = makeNode(CurrentOfExpr);
                    /* cvarno is filled in by parse analysis */
index c14b2f302e755175d17fe383eb434a849f56b8de..a689dbc70e68b235fbc20c1d7f88dedc9b42b7e4 100644 (file)
@@ -192,6 +192,11 @@ ECPG: stmtViewStmt rule
 
        output_simple_statement($1);
    }
+ECPG: where_or_current_clauseWHERECURRENT_POFcursor_name block
+   {
+       char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
+       $$ = cat_str(2,mm_strdup("where current of"), cursor_marker);
+   }
 ECPG: CopyStmtCOPYopt_binaryqualified_nameopt_column_listopt_oidscopy_fromcopy_file_namecopy_delimiteropt_withcopy_options addon
            if (strcmp($6, "to") == 0 && strcmp($7, "stdin") == 0)
                mmerror(PARSE_ERROR, ET_ERROR, "COPY TO STDIN is not possible");