Improve error message for misuse of TZ, tz, OF formatting patterns.

Be specific about which pattern is being complained of, and avoid saying
"it's not supported in to_date", which is just confusing if the error is
actually coming out of to_timestamp.  We can phrase it as "is only
supported in to_char", instead.  Also, use the term "formatting field" not
"format pattern", because other error messages in the same file prefer that
terminology.  (This isn't terribly consistent with the documentation, so
maybe we should change all these error messages?)
This commit is contained in:
Tom Lane 2017-02-20 10:27:48 -05:00
parent 10257fc5ff
commit 1c073505e8
1 changed files with 3 additions and 1 deletions

View File

@ -3031,7 +3031,9 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out)
case DCH_OF:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("\"TZ\"/\"tz\"/\"OF\" format patterns are not supported in to_date")));
errmsg("formatting field \"%s\" is only supported in to_char",
n->key->name)));
break;
case DCH_A_D:
case DCH_B_C:
case DCH_a_d: