Re: [HACKERS] Proposed changing the definition of decade for date_trunc and extract

2014-08-05 Thread Robert Haas
On Sun, Aug 3, 2014 at 3:29 PM, Gavin Flower wrote: > So it would probably be a good idea to mention in the relevant > documentation, that there was no Year Zero, and that 1 AD follows directly > after 1 BC. Well, maybe. By and large, the PostgreSQL documentation should confine itself to documen

Re: [HACKERS] Proposed changing the definition of decade for date_trunc and extract

2014-08-03 Thread Gavin Flower
On 04/08/14 01:27, Bruce Momjian wrote: On Sat, Aug 2, 2014 at 11:53:06PM -0700, Mike Swanson wrote: On Fri, 2014-08-01 at 22:28 -0700, Mike Swanson wrote: I'd also argue that the current function basing the logic from definition #2 has limited use even when you want to use it for such. If you

Re: [HACKERS] Proposed changing the definition of decade for date_trunc and extract

2014-08-03 Thread Bruce Momjian
On Sat, Aug 2, 2014 at 11:53:06PM -0700, Mike Swanson wrote: > On Fri, 2014-08-01 at 22:28 -0700, Mike Swanson wrote: > > I'd also argue that the current function basing the logic from > > definition #2 has limited use even when you want to use it for such. > > If you want to generate text for '(d

Re: [HACKERS] Proposed changing the definition of decade for date_trunc and extract

2014-08-02 Thread Mike Swanson
On Fri, 2014-08-01 at 22:28 -0700, Mike Swanson wrote: > I'd also argue that the current function basing the logic from > definition #2 has limited use even when you want to use it for such. > If you want to generate text for '(decades)s' you'd have to do: > SELECT extract('year' from date_trunc(

[HACKERS] Proposed changing the definition of decade for date_trunc and extract

2014-08-01 Thread Mike Swanson
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.