pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sachin Srivastava <sachin.srivastava@enterprisedb.com>
To: pgsql-bugs@postgresql.org
Subject: timestamp issue
Date: Thu, 17 Feb 2011 11:36:09 +0530
Message-ID: <379DB7E6-D1DD-4ADB-9454-5D67E9BF416D@enterprisedb.com> (raw)

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.

view thread (3+ messages)  latest in thread

Message-ID: <379DB7E6-D1DD-4ADB-9454-5D67E9BF416D@enterprisedb.com>
Permalink:  ../379DB7E6-D1DD-4ADB-9454-5D67E9BF416D@enterprisedb.com/
Also on:    postgresql.org/message-id/379DB7E6-D1DD-4ADB-9454-5D67E9BF416D@enterprisedb.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: sachin.srivastava@enterprisedb.com
  Subject: Re: timestamp issue
  In-Reply-To: <379DB7E6-D1DD-4ADB-9454-5D67E9BF416D@enterprisedb.com>
  References: <379DB7E6-D1DD-4ADB-9454-5D67E9BF416D@enterprisedb.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox