mirror of
https://github.com/postgres/postgres.git
synced 2025-11-22 12:22:45 +03:00
Reword recent error messages: "should" -> "must"
Most were introduced in the 17 timeframe. The ones in wparser_def.c are very old. I also changed "JSON path expression for column \"%s\" should return single item without wrapper" to "JSON path expression for column \"%s\" must return single item when no wrapper is requested" to avoid ambiguity. Backpatch to 17. Crickets: https://postgr.es/m/202501131819.26ors7oouafu@alvherre.pgsql
This commit is contained in:
@@ -2671,19 +2671,19 @@ prsd_headline(PG_FUNCTION_ARGS)
|
||||
if (min_words >= max_words)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("MinWords should be less than MaxWords")));
|
||||
errmsg("%s must be less than %s", "MinWords", "MaxWords")));
|
||||
if (min_words <= 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("MinWords should be positive")));
|
||||
errmsg("%s must be positive", "MinWords")));
|
||||
if (shortword < 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("ShortWord should be >= 0")));
|
||||
errmsg("%s must be >= 0", "ShortWord")));
|
||||
if (max_fragments < 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("MaxFragments should be >= 0")));
|
||||
errmsg("%s must be >= 0", "MaxFragments")));
|
||||
}
|
||||
|
||||
/* Locate words and phrases matching the query */
|
||||
|
||||
@@ -3977,13 +3977,13 @@ JsonPathQuery(Datum jb, JsonPath *jp, JsonWrapper wrapper, bool *empty,
|
||||
if (column_name)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_MORE_THAN_ONE_SQL_JSON_ITEM),
|
||||
errmsg("JSON path expression for column \"%s\" should return single item without wrapper",
|
||||
errmsg("JSON path expression for column \"%s\" must return single item when no wrapper is requested",
|
||||
column_name),
|
||||
errhint("Use the WITH WRAPPER clause to wrap SQL/JSON items into an array.")));
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_MORE_THAN_ONE_SQL_JSON_ITEM),
|
||||
errmsg("JSON path expression in JSON_QUERY should return single item without wrapper"),
|
||||
errmsg("JSON path expression in JSON_QUERY must return single item when no wrapper is requested"),
|
||||
errhint("Use the WITH WRAPPER clause to wrap SQL/JSON items into an array.")));
|
||||
}
|
||||
|
||||
@@ -4041,12 +4041,12 @@ JsonPathValue(Datum jb, JsonPath *jp, bool *empty, bool *error, List *vars,
|
||||
if (column_name)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_MORE_THAN_ONE_SQL_JSON_ITEM),
|
||||
errmsg("JSON path expression for column \"%s\" should return single scalar item",
|
||||
errmsg("JSON path expression for column \"%s\" must return single scalar item",
|
||||
column_name)));
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_MORE_THAN_ONE_SQL_JSON_ITEM),
|
||||
errmsg("JSON path expression in JSON_VALUE should return single scalar item")));
|
||||
errmsg("JSON path expression in JSON_VALUE must return single scalar item")));
|
||||
}
|
||||
|
||||
res = JsonValueListHead(&found);
|
||||
@@ -4065,12 +4065,12 @@ JsonPathValue(Datum jb, JsonPath *jp, bool *empty, bool *error, List *vars,
|
||||
if (column_name)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SQL_JSON_SCALAR_REQUIRED),
|
||||
errmsg("JSON path expression for column \"%s\" should return single scalar item",
|
||||
errmsg("JSON path expression for column \"%s\" must return single scalar item",
|
||||
column_name)));
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SQL_JSON_SCALAR_REQUIRED),
|
||||
errmsg("JSON path expression in JSON_VALUE should return single scalar item")));
|
||||
errmsg("JSON path expression in JSON_VALUE must return single scalar item")));
|
||||
}
|
||||
|
||||
if (res->type == jbvNull)
|
||||
|
||||
Reference in New Issue
Block a user