From: Tom Lane <tgl@sss.pgh.pa.us>
To: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: john@flowlabs.com
Cc: pgsql-sql@postgresql.org
Subject: Re: problems with date and interval queries.
Date: Mon, 10 Feb 2003 13:21:25 -0500
Message-ID: <15567.1044901285@sss.pgh.pa.us> (raw)
In-Reply-To: <20030210101150.P99596-100000@megazone23.bigpanda.com>
References: <20030210101150.P99596-100000@megazone23.bigpanda.com>
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.
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, ...)
regards, tom lane
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: tgl@sss.pgh.pa.us, sszabo@megazone23.bigpanda.com, john@flowlabs.com
Subject: Re: problems with date and interval queries.
In-Reply-To: <15567.1044901285@sss.pgh.pa.us>
* 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