Re: unexpected check constraint violation - Mailing list pgsql-general

From Tom Lane
Subject Re: unexpected check constraint violation
Date
Msg-id 4597.1237849670@sss.pgh.pa.us
Whole thread Raw
In response to Re: unexpected check constraint violation  (Scott Marlowe <scott.marlowe@gmail.com>)
List pgsql-general
Scott Marlowe <scott.marlowe@gmail.com> writes:
> You can either cast the check constraint, or change the field type to
> match double precision.

The short answer here is that 0.00603::double precision and
0.00603::real are unlikely to be exactly the same value, and
which one is greater is a matter of which direction the real
got rounded off in.  On my machine the former is a bit larger:

regression=# select 0.00603::double precision - 0.00603::real;
       ?column?
----------------------
 1.85072421797494e-10
(1 row)

but on another platform it could be the other way around.

            regards, tom lane

pgsql-general by date:

Previous
From: Ivan Sergio Borgonovo
Date:
Subject: Re: text column constraint, newbie question
Next
From: Tom Lane
Date:
Subject: Re: libpq -- reading a timestamp with time zone using binary format