Time intervals in select statement

Поиск
Список
Период
Сортировка
От Luke McFarlane
Тема Time intervals in select statement
Дата
Msg-id 4174BCA0.70506@fisheye.com.au
обсуждение исходный текст
Ответы Re: Time intervals in select statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Mac OS X make check errors...
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Time intervals in select statement