now() returning int4

Поиск
Список
Период
Сортировка
От Marc Tardif
Тема now() returning int4
Дата
Msg-id Pine.BSF.4.10.10001311649310.63602-100000@server.b0x.com
обсуждение исходный текст
Ответы Re: [SQL] now() returning int4  ("Ross J. Reedstrom" <reedstrm@wallace.ece.rice.edu>)
Список pgsql-sql
I have a table containing an integer field defaulting to now(), which I
want to use as the unix timestamp counting the seconds from jan 1 1970.
Problem is when I try to perform queries using now():

db=> CREATE TABLE test (
db-> date int default now()
db-> );
CREATE
db=> SELECT * FROM test WHERE date < now();
ERROR:  Unable to identify operator '<' for types 'int4' and 'timestamp'       You will have to retype this query using
anexplicit cast
 
db=> SELECT * FROM test WHERE date::timestamp < now();
bis
db=> SELECT * FROM test WHERE date < now()::int4;
bis

Please let me know how I can get this to work properly, I'm using
postgresql 6.5.3.

Marc



В списке pgsql-sql по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [SQL] inet/cidr - can this be done?
Следующее
От: "Ross J. Reedstrom"
Дата:
Сообщение: Re: [SQL] now() returning int4