Re: timestamp issue

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: timestamp issue
Дата
Msg-id 4D5CD167.10908@enterprisedb.com
обсуждение исходный текст
Ответ на timestamp issue  (Sachin Srivastava <sachin.srivastava@enterprisedb.com>)
Ответы Re: timestamp issue  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On 17.02.2011 08:06, Sachin Srivastava wrote:
> postgres=# SELECT now() + '7 days' AS week_ahead;
>              week_ahead
> ----------------------------------
>   2011-02-24 10:39:29.951931+05:30
> (1 row)
>
> postgres=# SELECT now() - '7 days' AS week_behind;
> ERROR:  invalid input syntax for type timestamp with time zone: "7 days"
> LINE 1: SELECT now() - '7 days' AS week_behind;
>                                              ^
>
> Now, if '+' operator  works with '7 days', why dint the '-' operator? Is this intentional or a bug?

Intentional, or at least coincidental.

postgres=# SELECT oprname, oprleft::regtype, oprright::regtype FROM
pg_operator WHERE oprleft ='timestamptz'::regtype AND oprname IN('+', '-');
  oprname |         oprleft          |         oprright
---------+--------------------------+--------------------------
  +       | timestamp with time zone | interval
  -       | timestamp with time zone | timestamp with time zone
  -       | timestamp with time zone | interval
(3 rows)

With '-', it's getting interpreted as timestamptz-timestamptz.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

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

Предыдущее
От: Sachin Srivastava
Дата:
Сообщение: timestamp issue
Следующее
От: Vegard Bønes
Дата:
Сообщение: Re: BUG #5883: Error when mixing SPI_returntuple with returning regular HeapTuple