mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +03:00
Improve the recently-added support for properly pluralized error messages
by extending the ereport() API to cater for pluralization directly. This is better than the original method of calling ngettext outside the elog.c code because (1) it avoids double translation, which wastes cycles and in the worst case could give a wrong result; and (2) it avoids having to use a different coding method in PL code than in the core backend. The client-side uses of ngettext are not touched since neither of these concerns is very pressing in the client environment. Per my proposal of yesterday.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.162 2009/03/26 22:26:06 petere Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.163 2009/06/04 18:33:06 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -112,10 +112,10 @@ ProcedureCreate(const char *procedureName,
|
||||
if (parameterCount < 0 || parameterCount > FUNC_MAX_ARGS)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
|
||||
errmsg(ngettext("functions cannot have more than %d argument",
|
||||
"functions cannot have more than %d arguments",
|
||||
FUNC_MAX_ARGS),
|
||||
FUNC_MAX_ARGS)));
|
||||
errmsg_plural("functions cannot have more than %d argument",
|
||||
"functions cannot have more than %d arguments",
|
||||
FUNC_MAX_ARGS,
|
||||
FUNC_MAX_ARGS)));
|
||||
/* note: the above is correct, we do NOT count output arguments */
|
||||
|
||||
if (allParameterTypes != PointerGetDatum(NULL))
|
||||
|
||||
Reference in New Issue
Block a user