Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
6c72f44c
Commit
6c72f44c
authored
Apr 15, 2004
by
Tom Lane
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve syntax error messages for invalid-argument cases in RETURN and
RETURN NEXT.
parent
0117ed7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
7 deletions
+17
-7
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/gram.y
+17
-7
No files found.
src/pl/plpgsql/src/gram.y
View file @
6c72f44c
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* procedural language
* procedural language
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.5
2 2004/03/24 23:38:49
tgl Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/gram.y,v 1.5
3 2004/04/15 13:01:45
tgl Exp $
*
*
* This software is copyrighted by Jan Wieck - Hamburg.
* This software is copyrighted by Jan Wieck - Hamburg.
*
*
...
@@ -1136,8 +1136,12 @@ stmt_return : K_RETURN lno
...
@@ -1136,8 +1136,12 @@ stmt_return : K_RETURN lno
new->retrecno = -1;
new->retrecno = -1;
new->retrowno = -1;
new->retrowno = -1;
if (plpgsql_curr_compile->fn_retistuple &&
if (plpgsql_curr_compile->fn_retset)
!plpgsql_curr_compile->fn_retset)
{
if (yylex() != ';')
yyerror("RETURN cannot have a parameter in function returning set; use RETURN NEXT");
}
else if (plpgsql_curr_compile->fn_retistuple)
{
{
switch (yylex())
switch (yylex())
{
{
...
@@ -1153,14 +1157,17 @@ stmt_return : K_RETURN lno
...
@@ -1153,14 +1157,17 @@ stmt_return : K_RETURN lno
break;
break;
default:
default:
yyerror("
return type mismatch
in function returning tuple");
yyerror("
RETURN must specify a record or row variable
in function returning tuple");
break;
break;
}
}
if (yylex() != ';')
if (yylex() != ';')
yyerror("
expected \";\"
");
yyerror("
RETURN must specify a record or row variable in function returning tuple
");
}
}
else
else
{
/* ordinary expression case */
new->expr = plpgsql_read_expression(';', ";");
new->expr = plpgsql_read_expression(';', ";");
}
new->cmd_type = PLPGSQL_STMT_RETURN;
new->cmd_type = PLPGSQL_STMT_RETURN;
new->lineno = $2;
new->lineno = $2;
...
@@ -1173,6 +1180,9 @@ stmt_return_next: K_RETURN_NEXT lno
...
@@ -1173,6 +1180,9 @@ stmt_return_next: K_RETURN_NEXT lno
{
{
PLpgSQL_stmt_return_next *new;
PLpgSQL_stmt_return_next *new;
if (!plpgsql_curr_compile->fn_retset)
yyerror("cannot use RETURN NEXT in a non-SETOF function");
new = malloc(sizeof(PLpgSQL_stmt_return_next));
new = malloc(sizeof(PLpgSQL_stmt_return_next));
memset(new, 0, sizeof(PLpgSQL_stmt_return_next));
memset(new, 0, sizeof(PLpgSQL_stmt_return_next));
...
@@ -1188,10 +1198,10 @@ stmt_return_next: K_RETURN_NEXT lno
...
@@ -1188,10 +1198,10 @@ stmt_return_next: K_RETURN_NEXT lno
else if (tok == T_ROW)
else if (tok == T_ROW)
new->row = yylval.row;
new->row = yylval.row;
else
else
yyerror("
incorrect argument to RETURN NEXT
");
yyerror("
RETURN NEXT must specify a record or row variable in function returning tuple
");
if (yylex() != ';')
if (yylex() != ';')
yyerror("
expected \";\"
");
yyerror("
RETURN NEXT must specify a record or row variable in function returning tuple
");
}
}
else
else
new->expr = plpgsql_read_expression(';', ";");
new->expr = plpgsql_read_expression(';', ";");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment