Unexpected interval comparison
Originally asked on pgsql-general[1]/messages/by-id/1490104629.422698.918452336.26FA96B7@webmail.messagingengine.com.
[1]: /messages/by-id/1490104629.422698.918452336.26FA96B7@webmail.messagingengine.com
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