Time intervals in select statement - Mailing list pgsql-bugs

From Luke McFarlane
Subject Time intervals in select statement
Date
Msg-id 4174BCA0.70506@fisheye.com.au
Whole thread Raw
Responses Re: Time intervals in select statement
List 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

pgsql-bugs by date:

Previous
From: Neil Conway
Date:
Subject: Re: Mac OS X make check errors...
Next
From: Tom Lane
Date:
Subject: Re: Time intervals in select statement