Fix a couple of places where the plpgsql grammar would produce an unhelpful
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 10 Sep 2008 01:09:45 +0000 (01:09 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 10 Sep 2008 01:09:45 +0000 (01:09 +0000)
'syntax error' message, rather than something that might draw one's
attention to a missing or wrong-type variable declaration.  Per recent
gripe.

src/pl/plpgsql/src/gram.y

index e6f806b066b3bcdfc0736017800b1fe66cb96ddc..278d45702556e8277de9298e00cc82917aa3a79b 100644 (file)
@@ -741,6 +741,18 @@ getdiag_target     : T_SCALAR
                                                check_assignable(yylval.scalar);
                                                $$ = yylval.scalar->dno;
                                        }
+                               | T_ROW
+                                       {
+                                               yyerror("expected an integer variable");
+                                       }
+                               | T_RECORD
+                                       {
+                                               yyerror("expected an integer variable");
+                                       }
+                               | T_WORD
+                                       {
+                                               yyerror("expected an integer variable");
+                                       }
                                ;
 
 
@@ -1669,6 +1681,18 @@ cursor_variable  : T_SCALAR
                                                }
                                                $$ = (PLpgSQL_var *) yylval.scalar;
                                        }
+                               | T_ROW
+                                       {
+                                               yyerror("expected a cursor or refcursor variable");
+                                       }
+                               | T_RECORD
+                                       {
+                                               yyerror("expected a cursor or refcursor variable");
+                                       }
+                               | T_WORD
+                                       {
+                                               yyerror("expected a cursor or refcursor variable");
+                                       }
                                ;
 
 exception_sect :