From: Ross J. Reedstrom <reedstrm@wallace.ece.rice.edu>
To: Marc Tardif <admin@wtbwts.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] now() returning int4
Date: Mon, 31 Jan 2000 16:28:40 -0600
Message-ID: <20000131162840.A5157@rice.edu> (raw)
In-Reply-To: <Pine.BSF.4.10.10001311649310.63602-100000@server.b0x.com>
References: <Pine.BSF.4.10.10001311649310.63602-100000@server.b0x.com>
On Mon, Jan 31, 2000 at 04:59:19PM +0000, Marc Tardif wrote:
> 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 an explicit cast
> db=> SELECT * FROM test WHERE date::timestamp < now();
> bis
> db=> SELECT * FROM test WHERE date < now()::int4;
> bis
>
SELECT * FROM test WHERE date < int(now());
Works here.
Ross
--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005
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-sql@postgresql.org
Cc: reedstrm@wallace.ece.rice.edu, admin@wtbwts.com
Subject: Re: [SQL] now() returning int4
In-Reply-To: <20000131162840.A5157@rice.edu>
References: <Pine.BSF.4.10.10001311649310.63602-100000@server.b0x.com> <20000131162840.A5157@rice.edu>
* 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