From: BD Postgres <postgres@master.abrente.es>
To: Aleksey Dashevsky <postgres@luckynet.co.il>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] sql date functions
Date: Mon, 06 Jul 1998 16:28:41 +0200
Message-ID: <35A0DF19.ADFF0E2A@master.abrente.es> (raw)
References: <Pine.LNX.3.96.SK.980706141824.9426A-100000@kesha.luckynet.co.il>
Aleksey Dashevsky wrote:
> Sorry, I really forgot: if you want to use date interval you need datetime
> type instead of date. Unforunately, postgres can only add timespan to
> datetime, but not to date, and also it doesn't have autoconversion from
> date to datetime:-(
>
> So, you eihter need to change all mentions of date type with datetime
> (don't forget to change it also in "create table"), or you need to cast
> back datetime to date:
>
> insert into table1 (date1,date2) values('1997-2-3'::date,('1997-2-3'::datetime
> + '1 week'::timespan)::date );
I'm using now dates and integers and it seems to work from psql although it's
giving me some problems from perl.
insert into quinielas (id,temporada,jornada,inicio,final) values
(13,1,1,'1-2-3'::date,'1-2-3'::date + 3);
works from psql ok, but when I try to do it from perl with DBI with
$sth->prepare('... values (?,?,?,?::date+?,?::date+?)');
$sth->execute(13,1,1,'1-2-3',3,'1-2-3',5);
it fails with a 'parameter unknown' error to the perl side although the postmaster
do not report any error. It seems to me this is more from perl that from postgres,
but anyway, some idea ?
- Salva.
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: postgres@master.abrente.es, postgres@luckynet.co.il
Subject: Re: [SQL] sql date functions
In-Reply-To: <35A0DF19.ADFF0E2A@master.abrente.es>
References: <Pine.LNX.3.96.SK.980706141824.9426A-100000@kesha.luckynet.co.il> <35A0DF19.ADFF0E2A@master.abrente.es>
* 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