aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/formatting.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2020-01-23 16:15:32 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2020-01-23 16:15:32 -0500
commitf309c812ed3106def62e940ca54718c7eeda8694 (patch)
tree0f1fc0ddf56365b9cef68f772cbfd7b97083c31b /src/backend/utils/adt/formatting.c
parentbe13f227febc386a892c8beedc2eb00938a57d2c (diff)
downloadpostgresql-f309c812ed3106def62e940ca54718c7eeda8694.tar.gz
postgresql-f309c812ed3106def62e940ca54718c7eeda8694.zip
Fix an oversight in commit 4c70098ff.
I had supposed that the from_char_seq_search() call sites were all passing the constant arrays you'd expect them to pass ... but on looking closer, the one for DY format was passing the days[] array not days_short[]. This accidentally worked because the day abbreviations in English are all the same as the first three letters of the full day names. However, once we took out the "maximum comparison length" logic, it stopped working. As penance for that oversight, add regression test cases covering this, as well as every other switch case in DCH_from_char() that was not reached according to the code coverage report. Also, fold the DCH_RM and DCH_rm cases into one --- now that seq_search is case independent, there's no need to pass different comparison arrays for those cases. Back-patch, as the previous commit was.
Diffstat (limited to 'src/backend/utils/adt/formatting.c')
-rw-r--r--src/backend/utils/adt/formatting.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index b345e0aeadf..51e1b28242c 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -3248,7 +3248,7 @@ DCH_from_char(FormatNode *node, const char *in, TmFromChar *out)
case DCH_DY:
case DCH_Dy:
case DCH_dy:
- from_char_seq_search(&value, &s, days,
+ from_char_seq_search(&value, &s, days_short,
n);
from_char_set_int(&out->d, value, n);
out->d++;
@@ -3347,10 +3347,6 @@ DCH_from_char(FormatNode *node, const char *in, TmFromChar *out)
SKIP_THth(s, n->suffix);
break;
case DCH_RM:
- from_char_seq_search(&value, &s, rm_months_upper,
- n);
- from_char_set_int(&out->mm, MONTHS_PER_YEAR - value, n);
- break;
case DCH_rm:
from_char_seq_search(&value, &s, rm_months_lower,
n);