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

Commit e813729

Browse files
committed
Add separate error message for procedure does not exist
While we probably don't want to split up all error messages into function and procedure variants, this one is a very prominent one, so it's helpful to be more specific here.
1 parent 0e4a466 commit e813729

File tree

2 files changed

+29
-10
lines changed

2 files changed

+29
-10
lines changed

src/backend/parser/parse_func.c

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -542,14 +542,24 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
542542
if (is_column)
543543
return NULL;
544544

545-
ereport(ERROR,
546-
(errcode(ERRCODE_AMBIGUOUS_FUNCTION),
547-
errmsg("function %s is not unique",
548-
func_signature_string(funcname, nargs, argnames,
549-
actual_arg_types)),
550-
errhint("Could not choose a best candidate function. "
551-
"You might need to add explicit type casts."),
552-
parser_errposition(pstate, location)));
545+
if (proc_call)
546+
ereport(ERROR,
547+
(errcode(ERRCODE_AMBIGUOUS_FUNCTION),
548+
errmsg("procedure %s is not unique",
549+
func_signature_string(funcname, nargs, argnames,
550+
actual_arg_types)),
551+
errhint("Could not choose a best candidate procedure. "
552+
"You might need to add explicit type casts."),
553+
parser_errposition(pstate, location)));
554+
else
555+
ereport(ERROR,
556+
(errcode(ERRCODE_AMBIGUOUS_FUNCTION),
557+
errmsg("function %s is not unique",
558+
func_signature_string(funcname, nargs, argnames,
559+
actual_arg_types)),
560+
errhint("Could not choose a best candidate function. "
561+
"You might need to add explicit type casts."),
562+
parser_errposition(pstate, location)));
553563
}
554564
else
555565
{
@@ -591,6 +601,15 @@ ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
591601
"after all regular arguments of the aggregate."),
592602
parser_errposition(pstate, location)));
593603
}
604+
else if (proc_call)
605+
ereport(ERROR,
606+
(errcode(ERRCODE_UNDEFINED_FUNCTION),
607+
errmsg("procedure %s does not exist",
608+
func_signature_string(funcname, nargs, argnames,
609+
actual_arg_types)),
610+
errhint("No procedure matches the given name and argument types. "
611+
"You might need to add explicit type casts."),
612+
parser_errposition(pstate, location)));
594613
else
595614
ereport(ERROR,
596615
(errcode(ERRCODE_UNDEFINED_FUNCTION),

src/test/regress/expected/create_procedure.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
CALL nonexistent(); -- error
2-
ERROR: function nonexistent() does not exist
2+
ERROR: procedure nonexistent() does not exist
33
LINE 1: CALL nonexistent();
44
^
5-
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
5+
HINT: No procedure matches the given name and argument types. You might need to add explicit type casts.
66
CALL random(); -- error
77
ERROR: random() is not a procedure
88
LINE 1: CALL random();

0 commit comments

Comments
 (0)