From: Bruno Wolff III <bruno@wolff.to>
To: javier garcia - CEBAS <rn001@cebas.csic.es>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: date question
Date: Sun, 22 Jun 2003 06:35:59 -0500
Message-ID: <20030622113559.GA10247@wolff.to> (raw)
In-Reply-To: <200306201719.h5KHJpI10111@natura.cebas.csic.es>
References: <Pine.LNX.4.44.0306171934390.2043-100000@peter.localdomain>
<200306201719.h5KHJpI10111@natura.cebas.csic.es>
On Fri, Jun 20, 2003 at 19:33:35 +0200,
javier garcia - CEBAS <rn001@cebas.csic.es> wrote:
> Hi all;
>
> Peter, thank you very much for your help. Just a little thing. I've done as
> you say:
>
> CREATE TABLE rain_series_dated AS SELECT (year * interval '1 year' + month *
> interval '1 month' + day * interval '1 day') AS
> fecha,est7237,est7238,est7239,est7250 FROM rain_series ORDER by fecha;
It would probably be better to use a view instead of copying the data
to another table. That way you don't need to worry about the data
getting out of sync.
> And I've tried to use this result to be compared with my other table in which
> "fecha" is "date" type. The result is that the query halts with no result; I
> guess that it is because it tries to compare different data types.
It wouldn't be because of trying to compare a date and an interval.
You would get an error message instead.
> Is it possible to cast the "interval" obtained type into a "date" one in the
> creation of the mentioned table? (I've looked it in the documentation, but I
> can't find the answer)
Not really. You could add the interval values to a base date, but that may
or may not make sense depending on your application.
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: bruno@wolff.to, rn001@cebas.csic.es, peter_e@gmx.net
Subject: Re: date question
In-Reply-To: <20030622113559.GA10247@wolff.to>
* 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