From: Frazer McLean <frazer@frazermclean.co.uk>
To: pgsql-bugs@postgresql.org
Subject: Unexpected interval comparison
Date: Wed, 29 Mar 2017 17:42:58 +0200
Message-ID: <1490802178.134161.927524440.76CFA134@webmail.messagingengine.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
Originally asked on pgsql-general[1].
[1]: https://www.postgresql.org/message-id/1490104629.422698.918452336.26FA96B7@webmail.messagingengine.c...
I came across an unexpected comparison (tested on PostgreSQL 9.4 and
9.6) for intervals with a large difference in magnitude.
I narrowed it down to this example, where comparisons within this range
give the wrong value:
postgres=# SELECT
'1 year'::interval > '3854933 years'::interval,
'1 year'::interval > '3854934 years'::interval,
'1 year'::interval > '32618664 years'::interval,
'1 year'::interval > '32618665 years'::interval;
?column? | ?column? | ?column? | ?column?
----------+----------+----------+----------
f | t | t | f
(1 row)
Kind regards,
Frazer McLean
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: frazer@frazermclean.co.uk
Subject: Re: Unexpected interval comparison
In-Reply-To: <1490802178.134161.927524440.76CFA134@webmail.messagingengine.com>
References: <1490802178.134161.927524440.76CFA134@webmail.messagingengine.com>
* 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