|
|
|
@ -4,7 +4,7 @@ |
|
|
|
* procedural language |
|
|
|
* procedural language |
|
|
|
* |
|
|
|
* |
|
|
|
* IDENTIFICATION |
|
|
|
* IDENTIFICATION |
|
|
|
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.29 2001/11/29 22:57:37 tgl Exp $ |
|
|
|
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.29.2.1 2002/05/21 18:50:18 tgl Exp $ |
|
|
|
* |
|
|
|
* |
|
|
|
* This software is copyrighted by Jan Wieck - Hamburg. |
|
|
|
* This software is copyrighted by Jan Wieck - Hamburg. |
|
|
|
* |
|
|
|
* |
|
|
|
@ -1327,17 +1327,44 @@ stmt_open : K_OPEN lno cursor_varptr |
|
|
|
if (tok != '(') |
|
|
|
if (tok != '(') |
|
|
|
{ |
|
|
|
{ |
|
|
|
plpgsql_error_lineno = yylineno; |
|
|
|
plpgsql_error_lineno = yylineno; |
|
|
|
elog(ERROR, "cursor %s has arguments", $3->refname); |
|
|
|
elog(ERROR, "cursor %s has arguments", |
|
|
|
|
|
|
|
$3->refname); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* Push back the '(', else read_sql_stmt |
|
|
|
|
|
|
|
* will complain about unbalanced parens. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
plpgsql_push_back_token(tok); |
|
|
|
|
|
|
|
|
|
|
|
new->argquery = read_sql_stmt("SELECT "); |
|
|
|
new->argquery = read_sql_stmt("SELECT "); |
|
|
|
/* Remove the trailing right paren, |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
* Now remove the leading and trailing parens, |
|
|
|
* because we want "select 1, 2", not |
|
|
|
* because we want "select 1, 2", not |
|
|
|
* "select (1, 2)". |
|
|
|
* "select (1, 2)". |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
cp = new->argquery->query; |
|
|
|
cp = new->argquery->query; |
|
|
|
cp += strlen(cp); |
|
|
|
|
|
|
|
--cp; |
|
|
|
if (strncmp(cp, "SELECT", 6) != 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
plpgsql_error_lineno = yylineno; |
|
|
|
|
|
|
|
elog(ERROR, "expected 'SELECT (', got '%s' (internal error)", |
|
|
|
|
|
|
|
new->argquery->query); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cp += 6; |
|
|
|
|
|
|
|
while (*cp == ' ') /* could be more than 1 space here */ |
|
|
|
|
|
|
|
cp++; |
|
|
|
|
|
|
|
if (*cp != '(') |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
plpgsql_error_lineno = yylineno; |
|
|
|
|
|
|
|
elog(ERROR, "expected 'SELECT (', got '%s' (internal error)", |
|
|
|
|
|
|
|
new->argquery->query); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
*cp = ' '; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cp += strlen(cp) - 1; |
|
|
|
|
|
|
|
|
|
|
|
if (*cp != ')') |
|
|
|
if (*cp != ')') |
|
|
|
{ |
|
|
|
{ |
|
|
|
plpgsql_error_lineno = yylineno; |
|
|
|
plpgsql_error_lineno = yylineno; |
|
|
|
|