Interval literal rounding bug(?) and patch.

Started by Ron Mayerover 17 years ago2 messageshackers
Jump to latest
#1Ron Mayer
rm_pg@cheapcomplexdevices.com

I think it's a bug that these 3 different ways of writing 0.7 seconds
produce different results from each other on HEAD.

head=# select interval '0:0:0.7', interval '@ 0.70 secs', interval '0.7 seconds';
interval | interval | interval
-------------+-----------------+-----------------
00:00:00.70 | 00:00:00.699999 | 00:00:00.699999
(1 row)

The attached patch will make all of those output "00:00:00.70" which.

Postgres 8.3 tended to output the "00:00:00.70" like this patch, I believe
because it didn't default to HAVE_INT64_TIMESTAMP like HEAD is. The patch
seems to pass the existing regression tests.

Does this seem reasonable?

Ron

Attachments:

intervalrounding.patchtext/x-diff; name=intervalrounding.patchDownload+16-16
#2Bruce Momjian
bruce@momjian.us
In reply to: Ron Mayer (#1)
Re: Interval literal rounding bug(?) and patch.

Ron Mayer wrote:

I think it's a bug that these 3 different ways of writing 0.7 seconds
produce different results from each other on HEAD.

head=# select interval '0:0:0.7', interval '@ 0.70 secs', interval '0.7 seconds';
interval | interval | interval
-------------+-----------------+-----------------
00:00:00.70 | 00:00:00.699999 | 00:00:00.699999
(1 row)

The attached patch will make all of those output "00:00:00.70" which.

Postgres 8.3 tended to output the "00:00:00.70" like this patch, I believe
because it didn't default to HAVE_INT64_TIMESTAMP like HEAD is. The patch
seems to pass the existing regression tests.

Does this seem reasonable?

Yes, very nice; patch applied. Thanks.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +