mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Message style improvements
An improvement pass over the new stats import functionality.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ relation_statistics_update(FunctionCallInfo fcinfo)
|
||||
{
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("reltuples cannot be < -1.0")));
|
||||
errmsg("argument \"%s\" must not be less than -1.0", "reltuples")));
|
||||
result = false;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -41,7 +41,7 @@ stats_check_required_arg(FunctionCallInfo fcinfo,
|
||||
if (PG_ARGISNULL(argnum))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("\"%s\" cannot be NULL",
|
||||
errmsg("argument \"%s\" must not be null",
|
||||
arginfo[argnum].argname)));
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ stats_check_arg_array(FunctionCallInfo fcinfo,
|
||||
{
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("\"%s\" cannot be a multidimensional array",
|
||||
errmsg("argument \"%s\" must not be a multidimensional array",
|
||||
arginfo[argnum].argname)));
|
||||
return false;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ stats_check_arg_array(FunctionCallInfo fcinfo,
|
||||
{
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("\"%s\" array cannot contain NULL values",
|
||||
errmsg("argument \"%s\" array must not contain null values",
|
||||
arginfo[argnum].argname)));
|
||||
return false;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ stats_check_arg_pair(FunctionCallInfo fcinfo,
|
||||
|
||||
ereport(WARNING,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("\"%s\" must be specified when \"%s\" is specified",
|
||||
errmsg("argument \"%s\" must be specified when argument \"%s\" is specified",
|
||||
arginfo[nullarg].argname,
|
||||
arginfo[otherarg].argname)));
|
||||
|
||||
@@ -263,7 +263,7 @@ stats_check_arg_type(const char *argname, Oid argtype, Oid expectedtype)
|
||||
if (argtype != expectedtype)
|
||||
{
|
||||
ereport(WARNING,
|
||||
(errmsg("argument \"%s\" has type \"%s\", expected type \"%s\"",
|
||||
(errmsg("argument \"%s\" has type %s, expected type %s",
|
||||
argname, format_type_be(argtype),
|
||||
format_type_be(expectedtype))));
|
||||
return false;
|
||||
@@ -319,11 +319,11 @@ stats_fill_fcinfo_from_arg_pairs(FunctionCallInfo pairs_fcinfo,
|
||||
|
||||
if (argnulls[i])
|
||||
ereport(ERROR,
|
||||
(errmsg("name at variadic position %d is NULL", i + 1)));
|
||||
(errmsg("name at variadic position %d is null", i + 1)));
|
||||
|
||||
if (types[i] != TEXTOID)
|
||||
ereport(ERROR,
|
||||
(errmsg("name at variadic position %d has type \"%s\", expected type \"%s\"",
|
||||
(errmsg("name at variadic position %d has type %s, expected type %s",
|
||||
i + 1, format_type_be(types[i]),
|
||||
format_type_be(TEXTOID))));
|
||||
|
||||
|
||||
@@ -50,26 +50,26 @@ SELECT pg_clear_relation_stats('stats_import', 'test');
|
||||
SELECT pg_catalog.pg_restore_relation_stats(
|
||||
'relname', 'test',
|
||||
'relpages', 17::integer);
|
||||
ERROR: "schemaname" cannot be NULL
|
||||
ERROR: argument "schemaname" must not be null
|
||||
-- error: relname missing
|
||||
SELECT pg_catalog.pg_restore_relation_stats(
|
||||
'schemaname', 'stats_import',
|
||||
'relpages', 17::integer);
|
||||
ERROR: "relname" cannot be NULL
|
||||
ERROR: argument "relname" must not be null
|
||||
--- error: schemaname is wrong type
|
||||
SELECT pg_catalog.pg_restore_relation_stats(
|
||||
'schemaname', 3.6::float,
|
||||
'relname', 'test',
|
||||
'relpages', 17::integer);
|
||||
WARNING: argument "schemaname" has type "double precision", expected type "text"
|
||||
ERROR: "schemaname" cannot be NULL
|
||||
WARNING: argument "schemaname" has type double precision, expected type text
|
||||
ERROR: argument "schemaname" must not be null
|
||||
--- error: relname is wrong type
|
||||
SELECT pg_catalog.pg_restore_relation_stats(
|
||||
'schemaname', 'stats_import',
|
||||
'relname', 0::oid,
|
||||
'relpages', 17::integer);
|
||||
WARNING: argument "relname" has type "oid", expected type "text"
|
||||
ERROR: "relname" cannot be NULL
|
||||
WARNING: argument "relname" has type oid, expected type text
|
||||
ERROR: argument "relname" must not be null
|
||||
-- error: relation not found
|
||||
SELECT pg_catalog.pg_restore_relation_stats(
|
||||
'schemaname', 'stats_import',
|
||||
@@ -88,7 +88,7 @@ SELECT pg_restore_relation_stats(
|
||||
'schemaname', 'stats_import',
|
||||
'relname', 'test',
|
||||
NULL, '17'::integer);
|
||||
ERROR: name at variadic position 5 is NULL
|
||||
ERROR: name at variadic position 5 is null
|
||||
-- starting stats
|
||||
SELECT relpages, reltuples, relallvisible, relallfrozen
|
||||
FROM pg_class
|
||||
@@ -286,7 +286,7 @@ SELECT pg_restore_relation_stats(
|
||||
'reltuples', 400.0::real,
|
||||
'relallvisible', 4::integer,
|
||||
'relallfrozen', 3::integer);
|
||||
WARNING: argument "relpages" has type "text", expected type "integer"
|
||||
WARNING: argument "relpages" has type text, expected type integer
|
||||
pg_restore_relation_stats
|
||||
---------------------------
|
||||
f
|
||||
@@ -358,7 +358,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'attname', 'id',
|
||||
'inherited', false::boolean,
|
||||
'null_frac', 0.1::real);
|
||||
ERROR: "schemaname" cannot be NULL
|
||||
ERROR: argument "schemaname" must not be null
|
||||
-- error: schema does not exist
|
||||
SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'schemaname', 'nope',
|
||||
@@ -373,7 +373,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'attname', 'id',
|
||||
'inherited', false::boolean,
|
||||
'null_frac', 0.1::real);
|
||||
ERROR: "relname" cannot be NULL
|
||||
ERROR: argument "relname" must not be null
|
||||
-- error: relname does not exist
|
||||
SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'schemaname', 'stats_import',
|
||||
@@ -389,7 +389,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'attname', 'id',
|
||||
'inherited', false::boolean,
|
||||
'null_frac', 0.1::real);
|
||||
ERROR: "relname" cannot be NULL
|
||||
ERROR: argument "relname" must not be null
|
||||
-- error: NULL attname
|
||||
SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'schemaname', 'stats_import',
|
||||
@@ -397,7 +397,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'attname', NULL,
|
||||
'inherited', false::boolean,
|
||||
'null_frac', 0.1::real);
|
||||
ERROR: must specify either attname or attnum
|
||||
ERROR: must specify either "attname" or "attnum"
|
||||
-- error: attname doesn't exist
|
||||
SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'schemaname', 'stats_import',
|
||||
@@ -416,14 +416,14 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'attnum', 1::smallint,
|
||||
'inherited', false::boolean,
|
||||
'null_frac', 0.1::real);
|
||||
ERROR: cannot specify both attname and attnum
|
||||
ERROR: cannot specify both "attname" and "attnum"
|
||||
-- error: neither attname nor attnum
|
||||
SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'schemaname', 'stats_import',
|
||||
'relname', 'test',
|
||||
'inherited', false::boolean,
|
||||
'null_frac', 0.1::real);
|
||||
ERROR: must specify either attname or attnum
|
||||
ERROR: must specify either "attname" or "attnum"
|
||||
-- error: attribute is system column
|
||||
SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'schemaname', 'stats_import',
|
||||
@@ -439,7 +439,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'attname', 'id',
|
||||
'inherited', NULL::boolean,
|
||||
'null_frac', 0.1::real);
|
||||
ERROR: "inherited" cannot be NULL
|
||||
ERROR: argument "inherited" must not be null
|
||||
-- ok: just the fixed values, with version, no stakinds
|
||||
SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'schemaname', 'stats_import',
|
||||
@@ -527,7 +527,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.21::real,
|
||||
'most_common_freqs', '{0.1,0.2,0.3}'::real[]
|
||||
);
|
||||
WARNING: "most_common_vals" must be specified when "most_common_freqs" is specified
|
||||
WARNING: argument "most_common_vals" must be specified when argument "most_common_freqs" is specified
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -553,7 +553,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.21::real,
|
||||
'most_common_vals', '{1,2,3}'::text
|
||||
);
|
||||
WARNING: "most_common_freqs" must be specified when "most_common_vals" is specified
|
||||
WARNING: argument "most_common_freqs" must be specified when argument "most_common_vals" is specified
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -580,8 +580,8 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'most_common_vals', '{2,1,3}'::text,
|
||||
'most_common_freqs', '{0.2,0.1}'::double precision[]
|
||||
);
|
||||
WARNING: argument "most_common_freqs" has type "double precision[]", expected type "real[]"
|
||||
WARNING: "most_common_freqs" must be specified when "most_common_vals" is specified
|
||||
WARNING: argument "most_common_freqs" has type double precision[], expected type real[]
|
||||
WARNING: argument "most_common_freqs" must be specified when argument "most_common_vals" is specified
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -659,7 +659,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.24::real,
|
||||
'histogram_bounds', '{1,NULL,3,4}'::text
|
||||
);
|
||||
WARNING: "histogram_bounds" array cannot contain NULL values
|
||||
WARNING: "histogram_bounds" array must not contain null values
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -709,7 +709,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.25::real,
|
||||
'elem_count_histogram', '{1,1,NULL,1,1,1,1,1}'::real[]
|
||||
);
|
||||
WARNING: "elem_count_histogram" array cannot contain NULL values
|
||||
WARNING: argument "elem_count_histogram" array must not contain null values
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -761,7 +761,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'range_empty_frac', 0.5::real,
|
||||
'range_length_histogram', '{399,499,Infinity}'::text
|
||||
);
|
||||
WARNING: attribute "id" is not a range type
|
||||
WARNING: column "id" is not a range type
|
||||
DETAIL: Cannot set STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM or STATISTIC_KIND_BOUNDS_HISTOGRAM.
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
@@ -788,7 +788,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.28::real,
|
||||
'range_length_histogram', '{399,499,Infinity}'::text
|
||||
);
|
||||
WARNING: "range_empty_frac" must be specified when "range_length_histogram" is specified
|
||||
WARNING: argument "range_empty_frac" must be specified when argument "range_length_histogram" is specified
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -814,7 +814,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.29::real,
|
||||
'range_empty_frac', 0.5::real
|
||||
);
|
||||
WARNING: "range_length_histogram" must be specified when "range_empty_frac" is specified
|
||||
WARNING: argument "range_length_histogram" must be specified when argument "range_empty_frac" is specified
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -865,7 +865,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.31::real,
|
||||
'range_bounds_histogram', '{"[-1,1)","[0,4)","[1,4)","[1,100)"}'::text
|
||||
);
|
||||
WARNING: attribute "id" is not a range type
|
||||
WARNING: column "id" is not a range type
|
||||
DETAIL: Cannot set STATISTIC_KIND_RANGE_LENGTH_HISTOGRAM or STATISTIC_KIND_BOUNDS_HISTOGRAM.
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
@@ -917,7 +917,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'most_common_elems', '{3,1}'::text,
|
||||
'most_common_elem_freqs', '{0.3,0.2,0.2,0.3,0.0}'::real[]
|
||||
);
|
||||
WARNING: unable to determine element type of attribute "arange"
|
||||
WARNING: could not determine element type of column "arange"
|
||||
DETAIL: Cannot set STATISTIC_KIND_MCELEM or STATISTIC_KIND_DECHIST.
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
@@ -945,7 +945,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'most_common_elems', '{1,3}'::text,
|
||||
'most_common_elem_freqs', '{0.3,0.2,0.2,0.3,0.0}'::real[]
|
||||
);
|
||||
WARNING: unable to determine element type of attribute "id"
|
||||
WARNING: could not determine element type of column "id"
|
||||
DETAIL: Cannot set STATISTIC_KIND_MCELEM or STATISTIC_KIND_DECHIST.
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
@@ -972,7 +972,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.34::real,
|
||||
'most_common_elems', '{one,two}'::text
|
||||
);
|
||||
WARNING: "most_common_elem_freqs" must be specified when "most_common_elems" is specified
|
||||
WARNING: argument "most_common_elem_freqs" must be specified when argument "most_common_elems" is specified
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -998,7 +998,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.35::real,
|
||||
'most_common_elem_freqs', '{0.3,0.2,0.2,0.3}'::real[]
|
||||
);
|
||||
WARNING: "most_common_elems" must be specified when "most_common_elem_freqs" is specified
|
||||
WARNING: argument "most_common_elems" must be specified when argument "most_common_elem_freqs" is specified
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
f
|
||||
@@ -1049,7 +1049,7 @@ SELECT pg_catalog.pg_restore_attribute_stats(
|
||||
'null_frac', 0.36::real,
|
||||
'elem_count_histogram', '{1,1,1,1,1,1,1,1,1,1}'::real[]
|
||||
);
|
||||
WARNING: unable to determine element type of attribute "id"
|
||||
WARNING: could not determine element type of column "id"
|
||||
DETAIL: Cannot set STATISTIC_KIND_MCELEM or STATISTIC_KIND_DECHIST.
|
||||
pg_restore_attribute_stats
|
||||
----------------------------
|
||||
|
||||
Reference in New Issue
Block a user