X-Original-To: pgsql-sql@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 410AE924DB4 for ; Tue, 20 May 2003 13:37:12 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 35923-02 for ; Tue, 20 May 2003 13:36:59 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id A9828924D9A for ; Tue, 20 May 2003 13:36:44 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4KHagU6000228; Tue, 20 May 2003 13:36:43 -0400 (EDT) To: "Jan Bodey" Cc: pgsql-sql@postgresql.org Subject: Re: Date comparison question In-reply-to: References: Comments: In-reply-to "Jan Bodey" message dated "Tue, 20 May 2003 17:22:38 +0100" Date: Tue, 20 May 2003 13:36:42 -0400 Message-ID: <227.1053452202@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/395 X-Sequence-Number: 13560 "Jan Bodey" writes: > SELECT * FROM utable > WHERE now() - utimestamp > interval '10 hours'; > The problem I am having is that the interval is not fixed, and I would like > to be able to store it as a value in a database table. The unit of the > interval can, however, be fixed, and will almost certainly be fixed to > hours. Do you not want to store the values as type interval? That would seem like the most straightforward answer. If you really want to store them as plain numbers, there's a float-times-interval operator, so you could do something like ... > table.float8col * interval '1 hour'; regards, tom lane