Re: question about age()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: question about age()
Date: 2013-08-29 20:39:09
Message-ID: 3976.1377808749@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andreas Kretschmer <akretschmer(at)spamfence(dot)net> writes:
> '3 years' != '2 years 11 mons 30 days', but i got 0 rows, why?

Well, actually:

regression=# select '3 years'::interval = '2 years 11 mons 30 days'::interval;
?column?
----------
t
(1 row)

IIRC, interval comparison operators normalize the two values assuming that
1 month = 30 days. Which is kind of arbitrary, but without some such
assumption there's no way to have a scalar ordering of intervals at all.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message vibhuti nataraj 2013-08-29 21:59:23 Unable to CREATE SCHEMA and INSERT data in table in that schema in same EXECUTE
Previous Message Michael Nolan 2013-08-29 20:28:23 Re: question about age()