[GENERAL] unexpected check constraint violation

2009-03-23 Thread Jacek Becla

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

thanks
Jacek

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] unexpected check constraint violation

2009-03-23 Thread Jacek Becla

Thanks Ries. Do you know if that is a postgres feature or a bug?

In practice, I wanted to load the data from a file using
COPY FROM. Modifying a large csv file in impractical and
not very elegant.

thanks,
Jacek



ries van Twisk wrote:


On Mar 23, 2009, at 2:54 PM, Jacek Becla 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

thanks
Jacek



try this:

insert into t values (0.00603::real);

Ries







--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general