From: "Alexei A(dot)Romanenko" <A(dot)A(dot)Romanenko(at)inp(dot)nsk(dot)su>
To: pgsql-bugs(at)postgresql(dot)org
Subject:
Date: 2000-06-28 05:39:19
Message-ID: Pine.SGI.4.10.10006281142370.188925-100000@Sky.inp.nsk.su
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Your name : Alexei A. Romanenko
Your email address : A(dot)A(dot)Romanenko(at)inp(dot)nsk(dot)su

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel Pentium

Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.12 ELF

PostgreSQL version (example: PostgreSQL-7.0): PostgreSQL-7.0.2

Compiler used (example: gcc 2.8.0) :

Please enter a FULL description of your problem:
------------------------------------------------
It seems to me there is a problem with regular expressions.
When i create table and try to insert some restriction for
a fields, system accept it. Then, whem i insert something, which
dont match to regexp, it inserted anyway or backwards.

Maybe i am do something wrong, but...

Please describe a way to repeat the problem. Please try to
provide a concise reproducible example, if at all possible:
----------------------------------------------------------------------
arom> psql
1.
arom=> create table vv (v char(10) CHECK (v ~*
'^[a-z]+\(at)[a-z]+'));
CREATE
arom=> INSERT INTO vv VALUES ('aq(at)wwww');
INSERT 19863 1
arom=> INSERT INTO vv VALUES (' aq(at)wwww');
ERROR: ExecAppend: rejected due to CHECK constraint vv_v
arom=> INSERT INTO vv VALUES ('aq(at)2wwww');
ERROR: ExecAppend: rejected due to CHECK constraint vv_v
arom=> INSERT INTO vv VALUES ('aq(at)wwww ');
INSERT 19864 1
arom=> drop table vv;
DROP
arom=> create table vv (v char(10) CHECK (v ~* '^[a-z]+$'));
CREATE
arom=> INSERT INTO vv VALUES ('aq');
ERROR: ExecAppend: rejected due to CHECK constraint vv_v

In POSIX standart symbol '$' means END OF LINE. Right?

2.

arom=> create table vv (v char(10) CHECK (v ~* '[:alnum:]+'));
CREATE
arom=> INSERT INTO vv VALUES ('12345');
ERROR: ExecAppend: rejected due to CHECK constraint vv_v
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
arom=> INSERT INTO vv VALUES ('abcd');
INSERT 19895 1
arom=> INSERT INTO vv VALUES ('123abcd');
INSERT 19896 1
arom=> drop table vv;
DROP

[:alnum:] means [:alpha:] and [:digit:].
But [a-z0-9] works correct

If you know how this problem might be fixed, list the solution
below:
---------------------------------------------------------------------

Responses

  • Re: at 2000-07-03 14:51:10 from Tom Lane

Browse pgsql-bugs by date

  From Date Subject
Next Message Sergei Laskavy 2000-06-28 08:18:02 compilation of PostgreSQL 7.0.2 fails on Sun Solaris 2.5.1 using gcc 2.95.2 in interfaces/libpq++ if GNU ld is first in the $PATH
Previous Message Chris Pascoe 2000-06-27 13:22:59 Queries with multiple USINGs crash backend