postgres.git / summary / log / commit / refs
commit 1c073505e8e4fa8a03312fea714da25ab83cb5fa
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: Mon Feb 20 15:27:48 2017 +0000
First released in: 10.0
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?)
src/backend/utils/adt/formatting.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 4f3d8a11894..247234564e3 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -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:
[parent: 10257fc5ff74]