Joerg Wedeck (joerg.wedeck@datacare.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