[BUGS] Re: BUG #14632: Plus and minus operators inconsistency with leapyears and year intervals. - Mailing list pgsql-bugs

From Pedro Gimeno
Subject [BUGS] Re: BUG #14632: Plus and minus operators inconsistency with leapyears and year intervals.
Date
Msg-id 59031D98.5010008@personal.formauri.es
Whole thread Raw
In response to Re: [BUGS] BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.  (Pietro Pugni <pietro.pugni@gmail.com>)
List pgsql-bugs
Pietro Pugni wrote, On 2017-04-28 10:28:

> I’m aware that 2. and 4. can’t return different result because they are the same queries, but in that cases the
resultcorrectness depends on the context.
 

You can use 10*interval '31556952 seconds' to add or subtract 10 years with consistent results. 31556952 seconds is the
averagelength of the year in the Gregorian calendar. To use this approach, you need to start using timestamp instead of
date,and avoid using timestamp with time zone on a time zone that uses daylight savings.
 

I don't think PostgreSQL needs to do anything about this issue.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Pietro Pugni
Date:
Subject: Re: [BUGS] BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
Next
From: Huong Dangminh
Date:
Subject: [BUGS] typo in 9.6 release-note