Re: BUG #4878: function age() give a wrong interval

Поиск
Список
Период
Сортировка
От Philippe Amelant
Тема Re: BUG #4878: function age() give a wrong interval
Дата
Msg-id 1245927035.32711.33.camel@philippe-desktop
обсуждение исходный текст
Ответ на Re: BUG #4878: function age() give a wrong interval  (Frank Heikens <frankheikens@mac.com>)
Ответы Re: BUG #4878: function age() give a wrong interval  (Frank Heikens <frankheikens@mac.com>)
Re: BUG #4878: function age() give a wrong interval  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
Le jeudi 25 juin 2009 =C3=A0 11:40 +0200, Frank Heikens a =C3=A9crit :
> select
>     age(
>         '2009-06-23 18:36:05.064066+02' ,
>         '2009-05-12 18:36:05.064066+02') ;
>=20
> Result: "1 mon 11 days"
>=20
> select justify_interval('1000 hours');
>=20
> Result: "1 mon 11 days 16:00:00"
>=20
> select
>     age(
>         '2009-06-23 18:36:05.064066+02' ,
>         '2009-05-12 18:36:05.064066+02')
>     > interval '1000 hours'
> ;
>=20
> Result: false
>=20
> And that's correct, 1 month and 11 days is less than 1 month, 11 days=20=
=20
> and 16 hours, it's not more. This is the actual comparison:
>=20
> select interval '1 mon 11 day' > interval '1 mon 11 day 16 hour';
>=20
> I don't see a problem nor a bug.

this is wrong because first interval is 1008 hour and the second is 1000
hours

In the first case you have a month with 31 days and in the second you
have a month with 30 days

try this

select
age(current_timestamp , current_timestamp - '1008 hours'::interval)
> interval '1000 hours'

so 1000 > 1008=20

regards

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Frank Heikens
Дата:
Сообщение: Re: BUG #4878: function age() give a wrong interval
Следующее
От: Frank Heikens
Дата:
Сообщение: Re: BUG #4878: function age() give a wrong interval