pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pedro Gimeno <pgsql-004@personal.formauri.es>
To: Pietro Pugni <pietro.pugni@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
Date: Fri, 28 Apr 2017 12:46:48 +0200
Message-ID: <59031D98.5010008@personal.formauri.es> (raw)
In-Reply-To: <F85A433C-95EA-40DE-A325-2EFF1E6DADFF@gmail.com>
References: <20170426182322.24371.95224@wrigleys.postgresql.org>
	<CAKFQuwZ+PXKFrQ+LqOOorfva9nMesie0WQpe_hJTdkMn7vCZAw@mail.gmail.com>
	<5752C491-B0EC-4D1E-AF97-5E1C8C793A8A@gmail.com>
	<CAKFQuwZDo-CwNiqJ_v64HkKntggFmz1sN82n+FLy99qfez9-3g@mail.gmail.com>
	<AA4AA8B1-AD27-458F-9941-6E5B5F56EACA@gmail.com>
	<59024CC9.6050109@personal.formauri.es>
	<F85A433C-95EA-40DE-A325-2EFF1E6DADFF@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.


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



view thread (25+ messages)

Message-ID: <59031D98.5010008@personal.formauri.es>
Permalink:  ../59031D98.5010008@personal.formauri.es/
Also on:    postgresql.org/message-id/59031D98.5010008@personal.formauri.es

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pgsql-004@personal.formauri.es, pietro.pugni@gmail.com
  Subject: Re: BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.
  In-Reply-To: <59031D98.5010008@personal.formauri.es>
  References: <20170426182322.24371.95224@wrigleys.postgresql.org> <CAKFQuwZ+PXKFrQ+LqOOorfva9nMesie0WQpe_hJTdkMn7vCZAw@mail.gmail.com> <5752C491-B0EC-4D1E-AF97-5E1C8C793A8A@gmail.com> <CAKFQuwZDo-CwNiqJ_v64HkKntggFmz1sN82n+FLy99qfez9-3g@mail.gmail.com> <AA4AA8B1-AD27-458F-9941-6E5B5F56EACA@gmail.com> <59024CC9.6050109@personal.formauri.es> <F85A433C-95EA-40DE-A325-2EFF1E6DADFF@gmail.com> <59031D98.5010008@personal.formauri.es>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox