Re: timestamp arithmetic (a possible bug?)

Поиск
Список
Период
Сортировка
От Ilir Gashi
Тема Re: timestamp arithmetic (a possible bug?)
Дата
Msg-id E1BgO1D-0003Rt-00@ms2.city.ac.uk
обсуждение исходный текст
Ответ на timestamp arithmetic (a possible bug?)  (Ilir Gashi <I.Gashi@city.ac.uk>)
Список pgsql-bugs
On Jul 2 2004, Achilleus Mantzios wrote:

> SELECT '01.01.2004 10:00:00'::timestamp + ('01.01.2004
> 10:01:00'::timestamp - '01.01.2004 10:00:00'::timestamp)::interval;
>      ?column?
> ---------------------
> 2004-01-01 10:01:00
> (1 row)
>
> works fine in my 7.4.2

Yes. I've just tried it in PostgreSQL 7.2 and it works fine there as well.



On Jul 2 2004, Theodore Petrosky wrote:

> Interesting....
>
> If I reverse the order it works...
>
> agencysacks=# SELECT CAST('01.01.2004 10:00:00' AS
> TIMESTAMP) + (CAST('01.01.2004 10:01:00' AS TIMESTAMP)
> - CAST('01.01.2004 10:00:00' AS TIMESTAMP)) as answer;
>        answer
> ---------------------
>  2004-01-01 10:01:00
> (1 row)

Yes. The above works for me as well in 7.2.


>
> However your original...
>
>
> agencysacks=# SELECT (CAST('01.01.2004 10:01:00' AS
> TIMESTAMP) - CAST('01.01.2004 10:00:00' AS TIMESTAMP))
> + CAST('01.01.2004 10:00:00' AS TIMESTAMP);
> ERROR:  operator does not exist: interval + timestamp
> without time zone
> HINT:  No operator matches the given name and argument
> type(s). You may need to add explicit type casts.
>
>
> agencysacks=# select version();
>
>   version
>
>
>
>
-------------------------------------------------------------------------------------------------------------------------
>  PostgreSQL 7.4.2 on powerpc-apple-darwin7.2.0,
> compiled by GCC gcc (GCC) 3.3 20030304 (Apple
> Computer, Inc. build 1495)
> (1 row)
>
> Looks like postgresql demands the  order to be
> timestamp +- interval.
>
> Ted

I am not getting the error above. I get the incorrect result as reported in
my original report. Does this mean that this was a buggy behaviour in 7.2
and then was changed in the latter releases to give the error message that
7.4.2 is giving?

Thanks for the quick responses.

Best regards,

Ilir
____________________________________________

Ilir Gashi
PhD Student
Centre for Software Reliability
City University
Northampton Square, London EC1V 0HB
email: i.gashi@city.ac.uk
website: http://www.csr.city.ac.uk/csr_city/staff/gashi/
____________________________________________

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: BUG #1186: Broken Index?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: timestamp arithmetic (a possible bug?)