On Mon, Mar 23, 2009 at 1:54 PM, Jacek Becla <becla(at)slac(dot)stanford(dot)edu> wrote:
> Hi,
>
> Can someone explain why postgres complains in this case:
>
> create table t(d real, check(d>=0.00603));
> insert into t values (0.00603);
>
> ERROR: new row for relation "t" violates check constraint "t_d_check"
Without any casting, 0.00603 likely evaluates to a numeric.
select 0.00603::numeric > 0.00603::real;
?column?
----------
t
So, this works:
create table t(d real, check(d>=0.00603::real));
insert into t values (0.00603);
INSERT 0 1