1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-16 06:01:02 +03:00

Make messages mentioning type names more uniform

This avoids additional translatable strings for each distinct type, as
well as making our quoting style around type names more consistent
(namely, that we don't quote type names).  This continues what started
as f402b99501.

Discussion: https://postgr.es/m/20160401170642.GA57509@alvherre.pgsql
This commit is contained in:
Alvaro Herrera
2017-01-18 16:08:20 -03:00
parent 716c7d4b24
commit 9a34123bc3
26 changed files with 155 additions and 129 deletions

View File

@ -1482,11 +1482,13 @@ CreateCast(CreateCastStmt *stmt)
if (nargs > 1 && procstruct->proargtypes.values[1] != INT4OID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("second argument of cast function must be type integer")));
errmsg("second argument of cast function must be type %s",
"integer")));
if (nargs > 2 && procstruct->proargtypes.values[2] != BOOLOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("third argument of cast function must be type boolean")));
errmsg("third argument of cast function must be type %s",
"boolean")));
if (!IsBinaryCoercible(procstruct->prorettype, targettypeid))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
@ -1776,7 +1778,8 @@ check_transform_function(Form_pg_proc procstruct)
if (procstruct->proargtypes.values[0] != INTERNALOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("first argument of transform function must be type \"internal\"")));
errmsg("first argument of transform function must be type %s",
"internal")));
}
@ -1859,7 +1862,8 @@ CreateTransform(CreateTransformStmt *stmt)
if (procstruct->prorettype != INTERNALOID)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("return data type of FROM SQL function must be \"internal\"")));
errmsg("return data type of FROM SQL function must be %s",
"internal")));
check_transform_function(procstruct);
ReleaseSysCache(tuple);
}