Interval - incorrect grammar form

Started by pinkeralmost 11 years ago3 messagesbugs
Jump to latest
#1pinker
pinker@onet.eu

Hi,
I've noticed that interval is shown incorrectly (in plural form) when date
is negative:

select age(timestamp '2015-09-01',timestamp '2017-10-02');
gives:
"-2 years -1 *mons* -1 days"

This mistake isn't present when date is positive
select age(now(),'2015-06-07');

"1 *mon* 9 days 11:53:37.567851"

It applies to versions:
"PostgreSQL 9.4.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2
20080704 (Red Hat 4.1.2-55), 64-bit"
and
"PostgreSQL 8.4.17 on i486-pc-linux-gnu, compiled by GCC gcc-4.4.real
(Debian 4.4.5-8) 4.4.5, 32-bit"

--
View this message in context: http://postgresql.nabble.com/Interval-incorrect-grammar-form-tp5858132.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#2Michael Paquier
michael@paquier.xyz
In reply to: pinker (#1)
Re: Interval - incorrect grammar form

On Thu, Jul 16, 2015 at 4:56 PM, pinker <pinker@onet.eu> wrote:

I've noticed that interval is shown incorrectly (in plural form) when date
is negative:

select age(timestamp '2015-09-01',timestamp '2017-10-02');
gives:
"-2 years -1 *mons* -1 days"

This mistake isn't present when date is positive
select age(now(),'2015-06-07');

"1 *mon* 9 days 11:53:37.567851"

It applies to versions:
"PostgreSQL 9.4.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2
20080704 (Red Hat 4.1.2-55), 64-bit"

It behaves like this for ages, and there are some applications that
surely rely on the current behavior, so I am not sure that it is worth
changing now even if that's grammatically incorrect (native
English-speaker wanted here for confirmation).
Regards,
--
Michael

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Michael Paquier (#2)
Re: Interval - incorrect grammar form

Michael Paquier <michael.paquier@gmail.com> writes:

On Thu, Jul 16, 2015 at 4:56 PM, pinker <pinker@onet.eu> wrote:

I've noticed that interval is shown incorrectly (in plural form) when date
is negative:

select age(timestamp '2015-09-01',timestamp '2017-10-02');
gives:
"-2 years -1 *mons* -1 days"

It behaves like this for ages, and there are some applications that
surely rely on the current behavior, so I am not sure that it is worth
changing now even if that's grammatically incorrect (native
English-speaker wanted here for confirmation).

Hm, "-1 mon" is probably better than "-1 mons", but it's somewhat
debatable; it's not clear to me that the convention about singular nouns
applies to negative quantities. And if you were arguing from
native-language conventions then writing "mon" rather than "month"
already feels pretty unnatural.

I tend to agree that backwards compatibility outweighs any benefit
we'd get here.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs