Re: Identifying function-lookup failures due to argument name mismatches

Chao Li <li.evan.chao@gmail.com>

From: Chao Li <li.evan.chao@gmail.com>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Dominique Devienne <ddevienne@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-08-28T01:53:15Z
Lists: pgsql-hackers

> On Aug 27, 2025, at 23:42, Peter Eisentraut <peter@eisentraut.org> wrote:
> 
> On 25.08.25 04:43, Chao Li wrote:
>> Can we avoid the duplication in a way like:
>> ```
>> static int
>> func_lookup_failure_details(int fgc_flags, List *argnames, bool proc_call)
>> {
>> 	const char *func_kind = proc_call ? "procedure" : "function";
>> 	/*
>> 	if (proc_call)
>> 		return errdetail("There is no procedure of that name.");
>> 	else
>> 		return errdetail("There is no function of that name.");
>> 	*/
>> 	return errdetail("There is no %s of that name.", func_kind);
>> ```
> 
> No, see here: https://www.postgresql.org/docs/devel/nls-programmer.html#NLS-GUIDELINES


Thank you Peter very much. It is good to learn.

--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




Commits

  1. Provide more-specific error details/hints for function lookup failures.