From: Stephan Szabo <sszabo@megazone23.bigpanda.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: john@flowlabs.com
Cc: pgsql-sql@postgresql.org
Subject: Re: problems with date and interval queries.
Date: Mon, 10 Feb 2003 11:03:43 -0800 (PST)
Message-ID: <20030210110244.G234-100000@megazone23.bigpanda.com> (raw)
In-Reply-To: <15567.1044901285@sss.pgh.pa.us>
On Mon, 10 Feb 2003, Tom Lane wrote:
> Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> > interval <stuff> 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 :)
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 using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: sszabo@megazone23.bigpanda.com, tgl@sss.pgh.pa.us, john@flowlabs.com
Subject: Re: problems with date and interval queries.
In-Reply-To: <20030210110244.G234-100000@megazone23.bigpanda.com>
* 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