Received: from wallace.ece.rice.edu (root@wallace.ece.rice.edu [128.42.12.154]) by hub.org (8.9.3/8.9.3) with ESMTP id RAA71215 for ; Mon, 31 Jan 2000 17:28:47 -0500 (EST) (envelope-from reedstrm@wallace.ece.rice.edu) Received: by wallace.ece.rice.edu via sendmail from stdin id (Debian Smail3.2.0.102) for pgsql-sql@postgresql.org; Mon, 31 Jan 2000 16:28:40 -0600 (CST) Date: Mon, 31 Jan 2000 16:28:40 -0600 From: "Ross J. Reedstrom" To: Marc Tardif Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] now() returning int4 Message-ID: <20000131162840.A5157@rice.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Mutt/1.0i In-Reply-To: ; from admin@wtbwts.com on Mon, Jan 31, 2000 at 04:59:19PM +0000 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., NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005