Skip site navigation (1) Skip section navigation (2)

BUG #3037: strange behave of CHECK constraint

From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3037: strange behave of CHECK constraint
Date: 2007-02-20 16:31:30
Message-ID: 200702201631.l1KGVU48054533@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      3037
Logged by:          Pavel Stehule
Email address:      pavel(dot)stehule(at)hotmail(dot)com
PostgreSQL version: 8.3
Operating system:   Linux
Description:        strange behave of CHECK constraint
Details: 

check constraint is incorect for operator SIMILAR

root=# create table products(
  barcode char(13) NOT NULL
  check (barcode NOT similar to '%[^0-9]%')
);

root=# insert into products values('22');
ERROR:  new row for relation "products" violates check constraint
"products_barcode_check"
root=# insert into products values('aa');
ERROR:  new row for relation "products" violates check constraint
"products_barcode_check"

root=# select '22'  NOT similar to '%[^0-9]%';
 ?column? 
----------
 t
(1 dka)

Responses

pgsql-bugs by date

Next:From: Eli GreenDate: 2007-02-20 16:31:58
Subject: BUG #3038: information_schema.constraint_column_usage has wrong information for foreign keys
Previous:From: Michael MeskesDate: 2007-02-20 13:09:32
Subject: Re: BUG #2973: Compile Error with MIPSpro compiler

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group