Skip to content

Commit 1c07350

Browse files
committed
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?)
1 parent 10257fc commit 1c07350

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/utils/adt/formatting.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3031,7 +3031,9 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out)
30313031
case DCH_OF:
30323032
ereport(ERROR,
30333033
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3034-
errmsg("\"TZ\"/\"tz\"/\"OF\" format patterns are not supported in to_date")));
3034+
errmsg("formatting field \"%s\" is only supported in to_char",
3035+
n->key->name)));
3036+
break;
30353037
case DCH_A_D:
30363038
case DCH_B_C:
30373039
case DCH_a_d:

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy