TH to_char modifier doesn't work with HH12
От | Heikki Linnakangas |
---|---|
Тема | TH to_char modifier doesn't work with HH12 |
Дата | |
Msg-id | 4A5222C1.9030607@enterprisedb.com обсуждение исходный текст |
Ответы |
Re: TH to_char modifier doesn't work with HH12
|
Список | pgsql-bugs |
The uppercase 'TH' modifier is not working with HH12: template1=# select to_char('3-MAY-2007 2:34'::timestamptz,'FMHHTH" HOUR OF THE "FMDDTH" DAY WAS ILL-FATED'::text); to_char --------------------------------------- 2nd HOUR OF THE 3RD DAY WAS ILL-FATED (1 row) Looking at the code, that looks like an oversight and the fix is trivial: --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -2094,7 +2094,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar * tm->tm_hour % (HOURS_PER_DAY / 2) == 0 ? 12 : tm->tm_hour % (HOURS_PER_DAY / 2)); if (S_THth(n->suffix)) - str_numth(s, s, 0); + str_numth(s, s, S_TH_TYPE(n->suffix)); s += strlen(s); break; case DCH_HH24: But given that it has been like that at least back to 8.0 which is the oldest version I have installed right now: does anyone see a reason not to fix that? -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com
В списке pgsql-bugs по дате отправления: