Re: Odd behavior with timestamp/interval arithmetic

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Odd behavior with timestamp/interval arithmetic
Дата
Msg-id web-1393514@davinci.ethosmedia.com
обсуждение исходный текст
Ответ на Odd behavior with timestamp/interval arithmetic  (Joseph Barillari <jbarilla@princeton.edu>)
Список pgsql-sql
Joe,

> Adding an interval to a timestamp produces the expected result:
> 
> cal=> select timestamp without time zone  'jan 1, 1999 00:00:00' +
> interval '1 month';  
>       ?column?       
> ---------------------
>  1999-02-01 00:00:00
> (1 row)
> 
> But reversing the two produces nonsense: is this because the values
> are implicitly cast to type of the leftmost term in the expression?

No.  It's a bug.  The expression interval + timestamp was accidentally
left undefined in PostgreSQL 7.2.


You can fix it by using a CREATE OPERATOR statement to define Interval
+ timestamp.

-Josh Berkus


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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: summary VIEW
Следующее
От: Gary Stainburn
Дата:
Сообщение: Re: summary VIEW