1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-18 02:02:55 +03:00

Message style improvements

An improvement pass over the new stats import functionality.
This commit is contained in:
Peter Eisentraut
2025-08-27 21:17:58 +02:00
parent 5865150b6d
commit 80f1106132
4 changed files with 52 additions and 49 deletions

View File

@@ -199,7 +199,7 @@ attribute_statistics_update(FunctionCallInfo fcinfo)
if (!PG_ARGISNULL(ATTNUM_ARG))
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("cannot specify both attname and attnum")));
errmsg("cannot specify both \"%s\" and \"%s\"", "attname", "attnum")));
attname = TextDatumGetCString(PG_GETARG_DATUM(ATTNAME_ARG));
attnum = get_attnum(reloid, attname);
/* note that this test covers attisdropped cases too: */
@@ -225,7 +225,7 @@ attribute_statistics_update(FunctionCallInfo fcinfo)
{
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("must specify either attname or attnum")));
errmsg("must specify either \"%s\" or \"%s\"", "attname", "attnum")));
attname = NULL; /* keep compiler quiet */
attnum = 0;
}
@@ -297,8 +297,9 @@ attribute_statistics_update(FunctionCallInfo fcinfo)
&elemtypid, &elem_eq_opr))
{
ereport(WARNING,
(errmsg("unable to determine element type of attribute \"%s\"", attname),
errdetail("Cannot set STATISTIC_KIND_MCELEM or STATISTIC_KIND_DECHIST.")));
(errmsg("could not determine element type of column \"%s\"", attname),
errdetail("Cannot set %s or %s.",
"STATISTIC_KIND_MCELEM", "STATISTIC_KIND_DECHIST")));
elemtypid = InvalidOid;
elem_eq_opr = InvalidOid;
@@ -313,8 +314,9 @@ attribute_statistics_update(FunctionCallInfo fcinfo)
{
ereport(WARNING,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("could not determine less-than operator for attribute \"%s\"", attname),
errdetail("Cannot set STATISTIC_KIND_HISTOGRAM or STATISTIC_KIND_CORRELATION.")));
errmsg("could not determine less-than operator for column \"%s\"", attname),
errdetail("Cannot set %s or %s.",
"STATISTIC_KIND_HISTOGRAM", "STATISTIC_KIND_CORRELATION")));
do_histogram = false;
do_correlation = false;
@@ -327,8 +329,9 @@ attribute_statistics_update(FunctionCallInfo fcinfo)
{
ereport(WARNING,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("attribute \"%s\" is not a range type", attname),
errdetail("Cannot set STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM or STATISTIC_KIND_BOUNDS_HISTOGRAM.")));
errmsg("column \"%s\" is not a range type", attname),
errdetail("Cannot set %s or %s.",
"STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM", "STATISTIC_KIND_BOUNDS_HISTOGRAM")));
do_bounds_histogram = false;
do_range_length_histogram = false;
@@ -587,7 +590,7 @@ get_attr_stat_type(Oid reloid, AttrNumber attnum,
if (!HeapTupleIsValid(atup))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("attribute %d of relation \"%s\" does not exist",
errmsg("column %d of relation \"%s\" does not exist",
attnum, RelationGetRelationName(rel))));
attr = (Form_pg_attribute) GETSTRUCT(atup);
@@ -595,7 +598,7 @@ get_attr_stat_type(Oid reloid, AttrNumber attnum,
if (attr->attisdropped)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("attribute %d of relation \"%s\" does not exist",
errmsg("column %d of relation \"%s\" does not exist",
attnum, RelationGetRelationName(rel))));
expr = get_attr_expr(rel, attr->attnum);
@@ -729,7 +732,7 @@ text_to_stavalues(const char *staname, FmgrInfo *array_in, Datum d, Oid typid,
{
ereport(WARNING,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("\"%s\" array cannot contain NULL values", staname)));
errmsg("\"%s\" array must not contain null values", staname)));
*ok = false;
return (Datum) 0;
}