Re: Bug #733: Date Arithmetics within plsql - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #733: Date Arithmetics within plsql
Date
Msg-id 28467.1028772417@sss.pgh.pa.us
Whole thread Raw
In response to Bug #733: Date Arithmetics within plsql  (pgsql-bugs@postgresql.org)
List pgsql-bugs
pgsql-bugs@postgresql.org writes:
> jw=# select inc_date (date  '2002-10-25', interval '1 day');
>   inc_date
> ------------
>  2002-10-26                  -> ok
> (1 row)

What you probably want here is the date plus integer operator.

There is no date plus interval operator --- what you are actually
getting is implicit promotion of date to timestamp, then timestamp
plus interval, then coercion back to date.  Unfortunately that's
going to create roundoff problems when you cross daylight-savings
boundaries.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Jean-Luc Lachance
Date:
Subject: Re: Bug #733: Date Arithmetics within plsql
Next
From: Tom Lane
Date:
Subject: Re: followup question Bug #476: pg_dump error: dtoi4: integer out of range