Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 41f4a0a

Browse files
committed
Fix to_date's handling of year 519.
A thinko in commit 029dfdf 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.
1 parent 82cdd2d commit 41f4a0a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/utils/adt/formatting.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,20 +1987,20 @@ static int
19871987
adjust_partial_year_to_2020(int year)
19881988
{
19891989
/*
1990-
* Adjust all dates toward 2020; this is effectively what happens when we
1990+
* Adjust all dates toward 2020; this is effectively what happens when we
19911991
* assume '70' is 1970 and '69' is 2069.
19921992
*/
19931993
/* Force 0-69 into the 2000's */
19941994
if (year < 70)
19951995
return year + 2000;
19961996
/* Force 70-99 into the 1900's */
1997-
else if (year >= 70 && year < 100)
1997+
else if (year < 100)
19981998
return year + 1900;
19991999
/* Force 100-519 into the 2000's */
2000-
else if (year >= 100 && year < 519)
2000+
else if (year < 520)
20012001
return year + 2000;
20022002
/* Force 520-999 into the 1000's */
2003-
else if (year >= 520 && year < 1000)
2003+
else if (year < 1000)
20042004
return year + 1000;
20052005
else
20062006
return year;

0 commit comments

Comments
 (0)