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

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Bruce Momjian <bruce(at)momjian(dot)us>, Mike Swanson <mikeonthecomputer(at)gmail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposed changing the definition of decade for date_trunc and extract
Date: 2014-08-03 19:29:25
Message-ID: 53DE8D95.9050304@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 want to generate text for '(decades)s' you'd have to do:
>>> SELECT extract('year' from date_trunc('decade', now())) || 's';
>>> Or with my patch:
>>> SELECT floor(extract('year' from now()) / 10) || '0s';
>>> It's different, for sure, but I would actually think the second one is
>>> a bit less awkward. Plus it's shorter :)
>> I'm responding to myself because I realized that what I wrote was a bit
>> silly. The first and current example (which is invalidated by my patch)
>> should really be:
>> SELECT extract('decade' from now()) || '0s';
>> which makes it the shorter and simpler version of the two. I'll still
>> stand by my opinion that it's not an extremely useful function as it is.
> Well, you can make the argument that since the 20th century is from 1901
> to 2000, that decades should be from *01 to *00. However, those
> centuries are ordinal, e.g. using "th", while decades are not. The
> decade is more a short-hand, rather than something that counts from year
> 1 like centuries. Looking at decades as an abbreviation supports our
> current behavior.
>
> I don't think 99% of people know there was no year 0, so I don't think
> you can base a lot on that.
>
I am not in favour of 'mushroom farming' - keeping people ignorant and
feeding them bullshit. So I don't think we should pander to ignorance.

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.

Cheers,
Gavin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Asif Naeem 2014-08-04 05:22:32 Re: [BUGS] BUG #9652: inet types don't support min/max
Previous Message Kevin Grittner 2014-08-03 15:55:47 Re: Usability improvements for pg_stop_backup()