summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2012-07-02 15:35:21 +0000
committerTom Lane2012-07-02 15:35:35 +0000
commit41f4a0ab789463971add986dbc778d77ec5a0ef4 (patch)
treef63bdf20b67bf6c725edd41beb63f2722b159cb3
parent82cdd2df759efe2b43183ee954b4a2e10b2c59f4 (diff)
Fix to_date's handling of year 519.
A thinko in commit 029dfdf1157b6d837a7b7211cd35b00c6bcd767c caused the year 519 to be handled differently from either adjacent year, which was not the intention AFAICS. Report and diagnosis by Marc Cousin. In passing, remove redundant re-tests of year value.
-rw-r--r--src/backend/utils/adt/formatting.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 765c6aa8d5e..b46cb876150 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1987,20 +1987,20 @@ static int
adjust_partial_year_to_2020(int year)
{
/*
- * Adjust all dates toward 2020; this is effectively what happens when we
+ * Adjust all dates toward 2020; this is effectively what happens when we
* assume '70' is 1970 and '69' is 2069.
*/
/* Force 0-69 into the 2000's */
if (year < 70)
return year + 2000;
/* Force 70-99 into the 1900's */
- else if (year >= 70 && year < 100)
+ else if (year < 100)
return year + 1900;
/* Force 100-519 into the 2000's */
- else if (year >= 100 && year < 519)
+ else if (year < 520)
return year + 2000;
/* Force 520-999 into the 1000's */
- else if (year >= 520 && year < 1000)
+ else if (year < 1000)
return year + 1000;
else
return year;