Skip site navigation (1) Skip section navigation (2)

Re: BUG #6028: age() function output contracts "months", but not any other units.

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "Martin A(dot) Brooks" <martin(at)antibodymx(dot)net>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6028: age() function output contracts "months", but not any other units.
Date: 2011-05-23 17:15:05
Message-ID: BANLkTikiz-VVGb_4EM=vjEBRA2pswL=Uhw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Wed, May 18, 2011 at 3:40 PM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> Martin A. Brooks wrote:
>>
>> The following bug has been logged online:
>>
>> Bug reference:      6028
>> Logged by:          Martin A. Brooks
>> Email address:      martin(at)antibodyMX(dot)net
>> PostgreSQL version: 9.0.4
>> Operating system:   Debian/GNU Linux 6
>> Description:        age() function output contracts "months", but not any
>> other units.
>> Details:
>>
>> Hi
>>
>> postgres=# select age(now(),'1973-12-20'::timestamp);
>>                    age
>> -----------------------------------------
>>  37 years 4 mons 28 days 15:33:49.041831
>> (1 row)
>>
>>
>> Note "mons" and not "months".  And if "mons", why not "yrs" and "dys"?
>
> I was hoping someone else knew a good answer to this question, but now
> that no one replied --- I have no idea on it was done this way.  I think
> this code came from Berkeley.  My guess is that the spelling was based
> on the libc struct tm field names:
>
>           int tm_mday;    /* day of month (1 - 31) */
>           int tm_mon;     /* month of year (0 - 11) */
>           int tm_year;    /* year - 1900 */
>
> The only clear answer I can think of is that "month" has five letters,
> and "year" and "day" have less then five letters.  :-|
>
> Does anyone feel this is worth changing?  I am concerned such a change
> would break many user applications.

The backward compatibility problem is pretty icky, but I don't much
like the idea of leaving it as-is, either.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2011-05-23 18:02:04
Subject: Re: BUG #6028: age() function output contracts "months", but not any other units.
Previous:From: Robert HaasDate: 2011-05-23 17:12:40
Subject: Re: BUG #5984: Got FailedAssertion("!(opaque->btpo_prev == target)", File: "nbtpage.c", Line: 1166)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group