Skip to content

Commit 7641224

Browse files
committed
Fix to_date()/to_timestamp() 'D' field for day of week, was off by one.
Converting from char using 'D' doesn't make lots of sense, of course. Report from Brendan Jurd.
1 parent a9eb539 commit 7641224

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/backend/utils/adt/formatting.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* -----------------------------------------------------------------------
22
* formatting.c
33
*
4-
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.123 2007/02/13 02:00:55 momjian Exp $
4+
* $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.124 2007/02/14 05:10:55 momjian Exp $
55
*
66
*
77
* Portions Copyright (c) 1999-2007, PostgreSQL Global Development Group
@@ -2484,6 +2484,7 @@ dch_date(int arg, char *inout, int suf, bool is_to_char, bool is_interval,
24842484
else
24852485
{
24862486
sscanf(inout, "%1d", &tmfc->d);
2487+
tmfc->d--;
24872488
return strspace_len(inout) + 1 + SKIP_THth(suf);
24882489
}
24892490
break;

0 commit comments

Comments
 (0)