timestamp issue

From: Sachin Srivastava <sachin(dot)srivastava(at)enterprisedb(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: timestamp issue
Date: 2011-02-17 06:06:09
Message-ID: 379DB7E6-D1DD-4ADB-9454-5D67E9BF416D@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello all,

I am running PostgreSQL 9.0.2 on Mac (10.6.6)

This is what I get in the psql terminal:

postgres=# SELECT version();
version
------------------------------------------------------------------------------------------------------------------------------------
PostgreSQL 9.0.2 on x86_64-apple-darwin, compiled by GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664), 64-bit
(1 row)

postgres=# SELECT now() + interval '7 days' AS week_ahead;
week_ahead
----------------------------------
2011-02-24 10:39:07.071655+05:30
(1 row)

postgres=# SELECT now() - interval '7 days' AS week_behind;
week_behind
----------------------------------
2011-02-10 10:39:21.848049+05:30
(1 row)

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?

--
Regards,
Sachin Srivastava
EnterpriseDB, the Enterprise PostgreSQL company.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2011-02-17 07:42:31 Re: timestamp issue
Previous Message tushar 2011-02-17 05:55:38 Re: 64-bit windows installer