Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3c221c3

Browse files
committed
Fix a couple of places where the plpgsql grammar would produce an unhelpful
'syntax error' message, rather than something that might draw one's attention to a missing or wrong-type variable declaration. Per recent gripe.
1 parent ee33b95 commit 3c221c3

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/pl/plpgsql/src/gram.y

Lines changed: 25 additions & 1 deletion
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.114 2008/09/02 20:37:55 tgl Exp $
12+
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.115 2008/09/10 01:09:45 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -741,6 +741,18 @@ getdiag_target : T_SCALAR
741741
check_assignable(yylval.scalar);
742742
$$ = yylval.scalar->dno;
743743
}
744+
| T_ROW
745+
{
746+
yyerror("expected an integer variable");
747+
}
748+
| T_RECORD
749+
{
750+
yyerror("expected an integer variable");
751+
}
752+
| T_WORD
753+
{
754+
yyerror("expected an integer variable");
755+
}
744756
;
745757

746758

@@ -1669,6 +1681,18 @@ cursor_variable : T_SCALAR
16691681
}
16701682
$$ = (PLpgSQL_var *) yylval.scalar;
16711683
}
1684+
| T_ROW
1685+
{
1686+
yyerror("expected a cursor or refcursor variable");
1687+
}
1688+
| T_RECORD
1689+
{
1690+
yyerror("expected a cursor or refcursor variable");
1691+
}
1692+
| T_WORD
1693+
{
1694+
yyerror("expected a cursor or refcursor variable");
1695+
}
16721696
;
16731697

16741698
exception_sect :

0 commit comments

Comments
 (0)