Time intervals in select statement

From: Luke McFarlane <luke(at)fisheye(dot)com(dot)au>
To: pgsql-bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Time intervals in select statement
Date: 2004-10-19 07:05:04
Message-ID: 4174BCA0.70506@fisheye.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello

Given the following example table:

CREATE TABLE foo ( create_time TIMESTAMP WITHOUT TIME ZONE );

INSERT INTO foo (create_time) VALUES (now());
INSERT INTO foo (create_time) VALUES (now());
INSERT INTO foo (create_time) VALUES (now());

This select statement works:

SELECT create_time, create_time + '8 days 16:49:22.600601' FROM foo;

create_time | ?column?
----------------------------+----------------------------
2004-10-19 16:59:31.065279 | 2004-10-28 09:48:53.66588
2004-10-19 16:59:33.790118 | 2004-10-28 09:48:56.390719
2004-10-19 16:59:34.398063 | 2004-10-28 09:48:56.998664

but this select statement doesnt:

SELECT create_time, create_time - '8 days 16:49:22.600601' FROM foo;

ERROR: invalid input syntax for type timestamp: "8 days 16:49:22.600601"

How can the expression '8 days 16:49:22.600601' be valid in the first
SELECT but not in the second?

I have reproduced this on 7.4.1 and 7.4.5.

Thanks
Luke

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-10-19 07:16:35 Re: Time intervals in select statement
Previous Message Neil Conway 2004-10-19 04:10:18 Re: Mac OS X make check errors...