Conversion errors for datetime fields

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Conversion errors for datetime fields
Date: 2000-12-28 15:55:52
Message-ID: 200012281555.eBSFtq305583@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Leonardo Frittelli (lfrittelli(at)tutopia(dot)com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Conversion errors for datetime fields

Long Description
I am currently using Postgresql version 7.0.2, but I did not find any reference to this problem in your bug/fix report for release 7.0.3.

I have noticed some conversion errors while using datetime/time fields with decimal values.
Here I send you two situations that I have been able to isolate.
I think that both are rounding errors.
I found these problems in Posgresql version 6.5.1 also, but it had been corrected in release 6.5.2. Now it has somehow reappeared.

Sample Code
-- Situation Nr 1
create table foo(
my_date datetime
);
insert into foo values (now()::date+'0:00:59.999999999999999'::time);
select my_date from foo;

-- Output from psql
--CREATE
--INSERT 90665 1
-- my_date
-----------------------------
-- 2000-12-28 00:01:60.00+00
--(1 row)
-- Note the '60 seconds' output

--------------------------------------------------------
-- Situation Nr 2

select '0:00:59.99999999999999'::time as fourteen_dec,
'0:00:59.999999999999999'::time as fifteen_dec;

-- Output from psql
-- fourteen_dec | fifteen_dec
----------------+-------------
-- 00:00:59 | 00:00:00
--(1 row)
-- Note that in the second case the result is rounded down instead of up

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2000-12-28 16:28:14 Re: Conversion errors for datetime fields
Previous Message Manuel GELE 2000-12-28 08:28:11 postgresql with opennm-0.5.0