Re: BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.

From: Pedro Gimeno <pgsql-004(at)personal(dot)formauri(dot)es>
To: Pietro Pugni <pietro(dot)pugni(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
Date: 2017-04-28 10:46:48
Message-ID: 59031D98.5010008@personal.formauri.es
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 result correctness depends on the context.

You can use 10*interval '31556952 seconds' to add or subtract 10 years with consistent results. 31556952 seconds is the average length 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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Huong Dangminh 2017-04-28 11:22:15 typo in 9.6 release-note
Previous Message Pietro Pugni 2017-04-28 10:46:38 Re: BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.