Re: possible bug on age() function (8.2.4 , 8.3.6)

Поиск
Список
Период
Сортировка
От Philippe Amelant
Тема Re: possible bug on age() function (8.2.4 , 8.3.6)
Дата
Msg-id 1245853343.32711.12.camel@philippe-desktop
обсуждение исходный текст
Ответ на Re: possible bug on age() function (8.2.4 , 8.3.6)  (Jasen Betts <jasen@xnet.co.nz>)
Список pgsql-general
Le mercredi 24 juin 2009 à 12:45 +0000, Jasen Betts a écrit :
> On 2009-06-24, Philippe Amelant <pamelant@companeo.com> wrote:
> > Ok but if I work with hours or whatever the problem is still there
> >
> > SELECT (EXTRACT(EPOCH FROM TIMESTAMP  '2009-06-23 18:36:05.064066+02') -
> > EXTRACT(EPOCH FROM TIMESTAMP '"2009-05-12 18:36:05.064066+02"'))/3600,
> > EXTRACT(EPOCH FROM interval '1008 hours')/3600, age('2009-06-23
> > 18:36:05.064066+02' ,'"2009-05-12 18:36:05.064066+02"') > interval '1007
> > hours';
> >
> > The third test should be true and not false
>
> The third test is comparing a double with an interval.
> compare like with like.
>
>  SELECT (EXTRACT(EPOCH FROM TIMESTAMP  '2009-06-23 18:36:05.064066+02') -
>  EXTRACT(EPOCH FROM TIMESTAMP '"2009-05-12 18:36:05.064066+02"'))/3600,
>  EXTRACT(EPOCH FROM interval '1008 hours')/3600, age('2009-06-23
>  18:36:05.064066+02' ,'"2009-05-12 18:36:05.064066+02"')
>  > EXTRACT(EPOCH FROM interval '1007 hours');
>
>
>

From de doc : age(timestamp, timestamp) return an interval so if I
wrote
select age('2009-06-23 18:36:05.064066+02' ,'"2009-05-12 18:36:05.064066
+02"') > interval '1000 hours';

I think I compare an interval with an interval.
the result should be true because there is 1008 hours between the 2
dates
But I need to substract more than 24 hours to get a 'true'

select age('2009-06-23 18:36:05.064066+02' ,'"2009-05-12 18:36:05.064066
+02"') > interval '983 hours';

So age() lost 24 H.



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

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: possible bug on age() function (8.2.4 , 8.3.6)
Следующее
От: Jack Orenstein
Дата:
Сообщение: JDBC prepared statements & server-side prepared statements