9
9
*
10
10
*
11
11
* IDENTIFICATION
12
- * $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.98 2007/02/08 18:37:14 tgl Exp $
12
+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.99 2007/02/19 03: 18:51 tgl Exp $
13
13
*
14
14
*-------------------------------------------------------------------------
15
15
*/
@@ -1728,9 +1728,7 @@ read_sql_construct(int until,
1728
1728
{
1729
1729
parenlevel--;
1730
1730
if (parenlevel < 0 )
1731
- ereport (ERROR,
1732
- (errcode (ERRCODE_SYNTAX_ERROR),
1733
- errmsg (" mismatched parentheses" )));
1731
+ yyerror (" mismatched parentheses" );
1734
1732
}
1735
1733
/*
1736
1734
* End of function definition is an error, and we don't expect to
@@ -1739,11 +1737,9 @@ read_sql_construct(int until,
1739
1737
*/
1740
1738
if (tok == 0 || tok == ' ;' )
1741
1739
{
1742
- plpgsql_error_lineno = lno;
1743
1740
if (parenlevel != 0 )
1744
- ereport (ERROR,
1745
- (errcode (ERRCODE_SYNTAX_ERROR),
1746
- errmsg (" mismatched parentheses" )));
1741
+ yyerror (" mismatched parentheses" );
1742
+ plpgsql_error_lineno = lno;
1747
1743
if (isexpression)
1748
1744
ereport (ERROR,
1749
1745
(errcode (ERRCODE_SYNTAX_ERROR),
@@ -1811,6 +1807,7 @@ read_datatype(int tok)
1811
1807
{
1812
1808
int lno;
1813
1809
PLpgSQL_dstring ds;
1810
+ char *type_name;
1814
1811
PLpgSQL_type *result;
1815
1812
bool needspace = false ;
1816
1813
int parenlevel = 0 ;
@@ -1833,14 +1830,10 @@ read_datatype(int tok)
1833
1830
{
1834
1831
if (tok == 0 )
1835
1832
{
1836
- plpgsql_error_lineno = lno;
1837
1833
if (parenlevel != 0 )
1838
- ereport (ERROR,
1839
- (errcode (ERRCODE_SYNTAX_ERROR),
1840
- errmsg (" mismatched parentheses" )));
1841
- ereport (ERROR,
1842
- (errcode (ERRCODE_SYNTAX_ERROR),
1843
- errmsg (" incomplete datatype declaration" )));
1834
+ yyerror (" mismatched parentheses" );
1835
+ else
1836
+ yyerror (" incomplete datatype declaration" );
1844
1837
}
1845
1838
/* Possible followers for datatype in a declaration */
1846
1839
if (tok == K_NOT || tok == K_ASSIGN || tok == K_DEFAULT)
@@ -1862,9 +1855,14 @@ read_datatype(int tok)
1862
1855
1863
1856
plpgsql_push_back_token (tok);
1864
1857
1858
+ type_name = plpgsql_dstring_get (&ds);
1859
+
1860
+ if (type_name[0 ] == ' \0 ' )
1861
+ yyerror (" missing datatype declaration" );
1862
+
1865
1863
plpgsql_error_lineno = lno; /* in case of error in parse_datatype */
1866
1864
1867
- result = plpgsql_parse_datatype (plpgsql_dstring_get (&ds) );
1865
+ result = plpgsql_parse_datatype (type_name );
1868
1866
1869
1867
plpgsql_dstring_free (&ds);
1870
1868
@@ -1895,21 +1893,11 @@ make_execsql_stmt(const char *sqlstart, int lineno)
1895
1893
if (tok == ' ;' )
1896
1894
break ;
1897
1895
if (tok == 0 )
1898
- {
1899
- plpgsql_error_lineno = plpgsql_scanner_lineno ();
1900
- ereport (ERROR,
1901
- (errcode (ERRCODE_SYNTAX_ERROR),
1902
- errmsg (" unexpected end of function definition" )));
1903
- }
1896
+ yyerror (" unexpected end of function definition" );
1904
1897
if (tok == K_INTO)
1905
1898
{
1906
1899
if (have_into)
1907
- {
1908
- plpgsql_error_lineno = plpgsql_scanner_lineno ();
1909
- ereport (ERROR,
1910
- (errcode (ERRCODE_SYNTAX_ERROR),
1911
- errmsg (" INTO specified more than once" )));
1912
- }
1900
+ yyerror (" INTO specified more than once" );
1913
1901
have_into = true ;
1914
1902
read_into_target (&rec, &row, &have_strict);
1915
1903
continue ;
0 commit comments