Fix ancient bug in handling of to_char modifier 'TH', when used with HH.
authorHeikki Linnakangas <heikki@enterprisedb.com>
Mon, 6 Jul 2009 19:11:39 +0000 (19:11 +0000)
committerHeikki Linnakangas <heikki@enterprisedb.com>
Mon, 6 Jul 2009 19:11:39 +0000 (19:11 +0000)
In what seems like an oversight, we used to treat 'TH' the same as lowercase
'th', but only with HH/HH12.

src/backend/utils/adt/formatting.c

index e4f70557c4e8cd13b8405459c8341c95de3403cf..73e3c845187a91db8aa292aaaf64f32742326820 100644 (file)
@@ -2094,7 +2094,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out)
                                                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: