mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
formatting.c cleanup: Remove unnecessary extra line breaks in error message literals
Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org
This commit is contained in:
@@ -2106,8 +2106,7 @@ from_char_set_mode(TmFromChar *tmfc, const FromCharDateMode mode,
|
|||||||
ereturn(escontext, false,
|
ereturn(escontext, false,
|
||||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||||
errmsg("invalid combination of date conventions"),
|
errmsg("invalid combination of date conventions"),
|
||||||
errhint("Do not mix Gregorian and ISO week date "
|
errhint("Do not mix Gregorian and ISO week date conventions in a formatting template.")));
|
||||||
"conventions in a formatting template.")));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2130,8 +2129,7 @@ from_char_set_int(int *dest, const int value, const FormatNode *node,
|
|||||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||||
errmsg("conflicting values for \"%s\" field in formatting string",
|
errmsg("conflicting values for \"%s\" field in formatting string",
|
||||||
node->key->name),
|
node->key->name),
|
||||||
errdetail("This value contradicts a previous setting "
|
errdetail("This value contradicts a previous setting for the same field type.")));
|
||||||
"for the same field type.")));
|
|
||||||
*dest = value;
|
*dest = value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2201,8 +2199,7 @@ from_char_parse_int_len(int *dest, const char **src, const size_t len, FormatNod
|
|||||||
node->key->name),
|
node->key->name),
|
||||||
errdetail("Field requires %zu characters, but only %zu remain.",
|
errdetail("Field requires %zu characters, but only %zu remain.",
|
||||||
len, used),
|
len, used),
|
||||||
errhint("If your source string is not fixed-width, "
|
errhint("If your source string is not fixed-width, try using the \"FM\" modifier.")));
|
||||||
"try using the \"FM\" modifier.")));
|
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
result = strtol(copy, &last, 10);
|
result = strtol(copy, &last, 10);
|
||||||
@@ -2215,8 +2212,7 @@ from_char_parse_int_len(int *dest, const char **src, const size_t len, FormatNod
|
|||||||
copy, node->key->name),
|
copy, node->key->name),
|
||||||
errdetail("Field requires %zu characters, but only %zu could be parsed.",
|
errdetail("Field requires %zu characters, but only %zu could be parsed.",
|
||||||
len, used),
|
len, used),
|
||||||
errhint("If your source string is not fixed-width, "
|
errhint("If your source string is not fixed-width, try using the \"FM\" modifier.")));
|
||||||
"try using the \"FM\" modifier.")));
|
|
||||||
|
|
||||||
*src += used;
|
*src += used;
|
||||||
}
|
}
|
||||||
@@ -2441,8 +2437,7 @@ from_char_seq_search(int *dest, const char **src, const char *const *array,
|
|||||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||||
errmsg("invalid value \"%s\" for \"%s\"",
|
errmsg("invalid value \"%s\" for \"%s\"",
|
||||||
copy, node->key->name),
|
copy, node->key->name),
|
||||||
errdetail("The given value did not match any of "
|
errdetail("The given value did not match any of the allowed values for this field.")));
|
||||||
"the allowed values for this field.")));
|
|
||||||
}
|
}
|
||||||
*src += len;
|
*src += len;
|
||||||
return true;
|
return true;
|
||||||
@@ -3337,8 +3332,7 @@ DCH_from_char(FormatNode *node, const char *in, TmFromChar *out,
|
|||||||
*/
|
*/
|
||||||
ereturn(escontext,,
|
ereturn(escontext,,
|
||||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||||
errmsg("invalid value \"%s\" for \"%s\"",
|
errmsg("invalid value \"%s\" for \"%s\"", s, n->key->name),
|
||||||
s, n->key->name),
|
|
||||||
errdetail("Time zone abbreviation is not recognized.")));
|
errdetail("Time zone abbreviation is not recognized.")));
|
||||||
}
|
}
|
||||||
/* otherwise parse it like OF */
|
/* otherwise parse it like OF */
|
||||||
@@ -3540,8 +3534,7 @@ DCH_from_char(FormatNode *node, const char *in, TmFromChar *out,
|
|||||||
if (matched < 2)
|
if (matched < 2)
|
||||||
ereturn(escontext,,
|
ereturn(escontext,,
|
||||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||||
errmsg("invalid value \"%s\" for \"%s\"",
|
errmsg("invalid value \"%s\" for \"%s\"", s, "Y,YYY")));
|
||||||
s, "Y,YYY")));
|
|
||||||
|
|
||||||
/* years += (millennia * 1000); */
|
/* years += (millennia * 1000); */
|
||||||
if (pg_mul_s32_overflow(millennia, 1000, &millennia) ||
|
if (pg_mul_s32_overflow(millennia, 1000, &millennia) ||
|
||||||
@@ -4114,8 +4107,7 @@ to_date(PG_FUNCTION_ARGS)
|
|||||||
if (!IS_VALID_JULIAN(tm.tm_year, tm.tm_mon, tm.tm_mday))
|
if (!IS_VALID_JULIAN(tm.tm_year, tm.tm_mon, tm.tm_mday))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("date out of range: \"%s\"",
|
errmsg("date out of range: \"%s\"", text_to_cstring(date_txt))));
|
||||||
text_to_cstring(date_txt))));
|
|
||||||
|
|
||||||
result = date2j(tm.tm_year, tm.tm_mon, tm.tm_mday) - POSTGRES_EPOCH_JDATE;
|
result = date2j(tm.tm_year, tm.tm_mon, tm.tm_mday) - POSTGRES_EPOCH_JDATE;
|
||||||
|
|
||||||
@@ -4123,8 +4115,7 @@ to_date(PG_FUNCTION_ARGS)
|
|||||||
if (!IS_VALID_DATE(result))
|
if (!IS_VALID_DATE(result))
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("date out of range: \"%s\"",
|
errmsg("date out of range: \"%s\"", text_to_cstring(date_txt))));
|
||||||
text_to_cstring(date_txt))));
|
|
||||||
|
|
||||||
PG_RETURN_DATEADT(result);
|
PG_RETURN_DATEADT(result);
|
||||||
}
|
}
|
||||||
@@ -4228,8 +4219,7 @@ parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict,
|
|||||||
if (!IS_VALID_JULIAN(tm.tm_year, tm.tm_mon, tm.tm_mday))
|
if (!IS_VALID_JULIAN(tm.tm_year, tm.tm_mon, tm.tm_mday))
|
||||||
ereturn(escontext, (Datum) 0,
|
ereturn(escontext, (Datum) 0,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("date out of range: \"%s\"",
|
errmsg("date out of range: \"%s\"", text_to_cstring(date_txt))));
|
||||||
text_to_cstring(date_txt))));
|
|
||||||
|
|
||||||
result = date2j(tm.tm_year, tm.tm_mon, tm.tm_mday) -
|
result = date2j(tm.tm_year, tm.tm_mon, tm.tm_mday) -
|
||||||
POSTGRES_EPOCH_JDATE;
|
POSTGRES_EPOCH_JDATE;
|
||||||
@@ -4238,8 +4228,7 @@ parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict,
|
|||||||
if (!IS_VALID_DATE(result))
|
if (!IS_VALID_DATE(result))
|
||||||
ereturn(escontext, (Datum) 0,
|
ereturn(escontext, (Datum) 0,
|
||||||
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
(errcode(ERRCODE_DATETIME_VALUE_OUT_OF_RANGE),
|
||||||
errmsg("date out of range: \"%s\"",
|
errmsg("date out of range: \"%s\"", text_to_cstring(date_txt))));
|
||||||
text_to_cstring(date_txt))));
|
|
||||||
|
|
||||||
*typid = DATEOID;
|
*typid = DATEOID;
|
||||||
return DateADTGetDatum(result);
|
return DateADTGetDatum(result);
|
||||||
@@ -4476,8 +4465,7 @@ do_to_timestamp(const text *date_txt, const text *fmt, Oid collid, bool std,
|
|||||||
{
|
{
|
||||||
errsave(escontext,
|
errsave(escontext,
|
||||||
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
(errcode(ERRCODE_INVALID_DATETIME_FORMAT),
|
||||||
errmsg("hour \"%d\" is invalid for the 12-hour clock",
|
errmsg("hour \"%d\" is invalid for the 12-hour clock", tm->tm_hour),
|
||||||
tm->tm_hour),
|
|
||||||
errhint("Use the 24-hour clock, or give an hour between 1 and 12.")));
|
errhint("Use the 24-hour clock, or give an hour between 1 and 12.")));
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user