Thread: Interval - incorrect grammar form
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.
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
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