Re: Bug #733: Date Arithmetics within plsql

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: joerg(dot)wedeck(at)datacare(dot)de, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Bug #733: Date Arithmetics within plsql
Date: 2002-08-07 17:09:04
Message-ID: 3D515430.25038E61@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

There is an extra hour on Oct 27th.
We go from daylight saving time back to standard time...

pgsql-bugs(at)postgresql(dot)org wrote:
>
> Joerg Wedeck (joerg(dot)wedeck(at)datacare(dot)de) reports a bug with a severity of 2
> The lower the number the more severe it is.
>
> Short Description
> Date Arithmetics within plsql
>
> Long Description
> Hi,
>
> i have a problem with date arithmetics in plpgsql which i was able to track down into one simple function:
>
> create function inc_date (date, interval) returns date as '
> declare
> help date;
> begin
> help := $1 + $2;
> return help;
> end;
> ' language 'plpgsql';
>
> the following is the result:
>
> jw=# select inc_date (date '2002-10-25', interval '1 day');
> inc_date
> ------------
> 2002-10-26 -> ok
> (1 row)
>
> jw=# select inc_date (date '2002-10-25', interval '2 days');
> inc_date
> ------------
> 2002-10-27 -> ok
> (1 row)
>
> jw=# select inc_date (date '2002-10-25', interval '3 days');
> inc_date
> ------------
> 2002-10-27 -> oops ???? i would expect 2002-10-28
> (1 row)
>
> jw=# select inc_date (date '2002-10-25', interval '4 days');
> inc_date
> ------------
> 2002-10-28
> (1 row)
>
> jw=# select inc_date (date '2002-10-25', interval '5 days');
> inc_date
> ------------
> 2002-10-29
> (1 row)
>
> it happens only around the 27 th of october this year, on 26th next year ...
>
> Version:
> jw=# SELECT version();
> version
> ---------------------------------------------------------------
> PostgreSQL 7.2.1 on i686-pc-linux-gnu, compiled by GCC 2.95.4
> (1 row)
>
> jw=#
>
> Installation:
> package postgresql 7.2.1-2
> debian/woody (same behavior on suse 8.0, redhat 7.3)
>
> thank you, joerg
>
> Sample Code
>
> No file was uploaded with this report
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-08-08 02:06:57 Re: Bug #733: Date Arithmetics within plsql
Previous Message Nathan Suderman 2002-08-07 16:44:00 followup question Bug #476: pg_dump error: dtoi4: integer out of range