Re: [SQL] Problem in age on a dates interval

2004-07-20 Thread Luis Sousa
Yes, that's a much more clever solution than the one I used. Thanks Best regards, Luis Sousa Alexander M. Pravking wrote: On Mon, Jul 19, 2004 at 10:00:50AM +0100, Luis Sousa wrote: I worked around this problem returning the difference between the two dates, using extract doy from both. Anyway,

Re: [SQL] Problem in age on a dates interval

2004-07-19 Thread Alexander M. Pravking
On Mon, Jul 19, 2004 at 10:00:50AM +0100, Luis Sousa wrote: > I worked around this problem returning the difference between the two > dates, using extract doy from both. > Anyway, this will cause a bug on my code when changing the year. Any ideas? Why don't you use the minus operator? SELECT '20

Re: [SQL] Problem in age on a dates interval

2004-07-19 Thread Luis Sousa
I worked around this problem returning the difference between the two dates, using extract doy from both. Anyway, this will cause a bug on my code when changing the year. Any ideas? Best regards, Luis Sousa Tom Lane wrote: Theodore Petrosky <[EMAIL PROTECTED]> writes: wow at first I though

Re: [SQL] Problem in age on a dates interval

2004-07-16 Thread Tom Lane
Theodore Petrosky <[EMAIL PROTECTED]> writes: > wow at first I thought I had my head around a leap > year problem so I advanced your query a year I think what's going on here is a difference of interpretation about whether an "M months D days" interval means to add the months first or the

Re: [SQL] Problem in age on a dates interval

2004-07-16 Thread Theodore Petrosky
Luis, wow at first I thought I had my head around a leap year problem so I advanced your query a year testbed=# SELECT age('2005-05-14 16:00'::timestamp,'2005-02-18 16:00'::timestamp); age 2 mons 24 days (1 row) testbed =# SELECT '2005-02-18 16:00'::timesta

[SQL] Problem in age on a dates interval

2004-07-16 Thread Luis Sousa
Hi all, I'm using PostgreSQL 7.3.3 on i386-pc-linux-gnu, compiled by GCC gcc (GCC) 3.3 (Debian), and I don't understand the results of the following queries: SELECT age('2004-05-14 16:00'::timestamp,'2004-02-18 16:00'::timestamp); age 2 mons 25 days SELECT '2004-02-1