BUG #8175: Check constraint fails for valid data. ( rounding related? )

From: dan(dot)libby(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8175: Check constraint fails for valid data. ( rounding related? )
Date: 2013-05-22 00:56:57
Message-ID: E1UexMP-0006so-A5@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 8175
Logged by: Dan Libby
Email address: dan(dot)libby(at)gmail(dot)com
PostgreSQL version: 9.1.6
Operating system: Linux ( Ubuntu 12.04 )
Description:

-- Try this script --

create table test1 (
val1 numeric(23,8),
val2 numeric(23,8),
product numeric(23,8) check( product = val1 * val2 )
);

select (2.23567567*3.70000000)::numeric(23,8);
insert into test1 values ( 3.70000000, 2.23567567, 8.27199998 );
insert into test1 values ( 3.70000000, 2.23567567, 2.23567567*3.70000000 );
insert into test1 values ( 3.70000000, 2.23567567,
(2.23567567*3.70000000)::numeric(23,8) );

-- Actual Results --

select (2.23567567*3.70000000)::numeric(23,8);
numeric | 8.27199998

btcx=# insert into test1 values ( 3.70000000, 2.23567567, 8.27199998 );
ERROR: new row for relation "test1" violates check constraint
"test1_check"
btcx=# insert into test1 values ( 3.70000000, 2.23567567,
2.23567567*3.70000000 );
ERROR: new row for relation "test1" violates check constraint
"test1_check"
btcx=# insert into test1 values ( 3.70000000, 2.23567567,
(2.23567567*3.70000000)::numeric(23,8) );
ERROR: new row for relation "test1" violates check constraint
"test1_check"

-- Expected Results --

All values should be inserted successfully.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message juancho gonzila jorrel 2013-05-22 14:20:40 pass to install
Previous Message polobo 2013-05-21 22:25:03 BUG #8174: Ownership reassigned public schema restored with postgres as owner