X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 3151430F322 for ; Sun, 22 Jun 2003 11:32:51 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 11064-03 for ; Sun, 22 Jun 2003 08:32:40 -0300 (ADT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 58D5830EF90 for ; Sun, 22 Jun 2003 08:32:40 -0300 (ADT) Received: (qmail 10353 invoked by uid 500); 22 Jun 2003 11:35:59 -0000 Date: Sun, 22 Jun 2003 06:35:59 -0500 From: Bruno Wolff III To: javier garcia - CEBAS Cc: Peter Eisentraut , "pgsql-sql@postgresql.org" Subject: Re: date question Message-ID: <20030622113559.GA10247@wolff.to> Mail-Followup-To: javier garcia - CEBAS , Peter Eisentraut , "pgsql-sql@postgresql.org" References: <200306201719.h5KHJpI10111@natura.cebas.csic.es> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200306201719.h5KHJpI10111@natura.cebas.csic.es> User-Agent: Mutt/1.5.4i X-Archive-Number: 200306/243 X-Sequence-Number: 14001 On Fri, Jun 20, 2003 at 19:33:35 +0200, javier garcia - CEBAS 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.