Proposed changing the definition of decade for date_trunc and extract - Mailing list pgsql-hackers

From Mike Swanson
Subject Proposed changing the definition of decade for date_trunc and extract
Date
Msg-id 1406937778.11508.1.camel@gmail.com
Whole thread Raw
Responses Re: Proposed changing the definition of decade for date_trunc and extract
List pgsql-hackers
For a long time (since version 8.0), PostgreSQL has adopted the logical
barriers for centuries and millenniums in these functions.  The calendar
starts millennium and century 1 on year 1, directly after 1 BC.
Unfortunately decades are still reported rather simplistically by
dividing the year by 10.  Years 1-10 are logically the first decade and
working up from there, year 2014 should be counted as 202nd decade.

I've pushed code and documentation changes to reflect this, based on the
master branch (9.5devel), it's on the branch new_decade_def at
https://github.com/chungy/postgres.git -- In both the commit message and
docs, I made note of the backwards compatibility change.  I don't know
how much of an impact this would have but I suspect not many
applications are really going to be affected by how decades are counted
(should be simple to fix on their part, if any are...).

-- Mike Swanson




pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: B-Tree support function number 3 (strxfrm() optimization)
Next
From: David Rowley
Date:
Subject: Small patch to fix windows build