X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 8DE694758DC for ; Mon, 10 Feb 2003 14:03:44 -0500 (EST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 0D38F4758BD for ; Mon, 10 Feb 2003 14:03:44 -0500 (EST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 2303CD60D; Mon, 10 Feb 2003 11:03:44 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 0E7005C02; Mon, 10 Feb 2003 11:03:44 -0800 (PST) Date: Mon, 10 Feb 2003 11:03:43 -0800 (PST) From: Stephan Szabo To: Tom Lane Cc: , Subject: Re: problems with date and interval queries. In-Reply-To: <15567.1044901285@sss.pgh.pa.us> Message-ID: <20030210110244.G234-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/200 X-Sequence-Number: 11598 On Mon, 10 Feb 2003, Tom Lane wrote: > Stephan Szabo writes: > > interval is the form for an interval literal. If the column is > > already an interval, you probably don't need it at all. If you need to > > cast it you should do a cast CAST (num_min AS INTERVAL) > > I don't believe there is a cast from any numeric type to interval. Yeah, but I think he was making an interval string in the subselect, something like '27 minutes'. > I'd recommend the interval-times-float operator. It should work to > write > > num_min * interval '1 min' > > This approach has the advantage that it trivially adapts to whatever > unit you happen to have the column stated in (seconds, minutes, days, ...) That's better in any case though :)