Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 106314763D4 for ; Tue, 10 Sep 2002 11:15:56 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 2DC40476092 for ; Tue, 10 Sep 2002 11:15:55 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g8AFFGKo019731; Tue, 10 Sep 2002 11:15:16 -0400 (EDT) To: Stephan Szabo Cc: Goran Buzic , pgsql-sql@postgresql.org Subject: Re: POSIX-style regular expressions In-reply-to: <20020910080224.L24403-100000@megazone23.bigpanda.com> References: <20020910080224.L24403-100000@megazone23.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Tue, 10 Sep 2002 08:04:14 -0700" Date: Tue, 10 Sep 2002 11:15:15 -0400 Message-ID: <19730.1031670915@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/72 X-Sequence-Number: 9349 Stephan Szabo writes: > On Tue, 10 Sep 2002, Goran Buzic wrote: >> id1 char(6) NOT NULL CHECK(id1 ~* '^([0-9]{1,2}\.){2}$'), > Bad column type choice. char(6) is space padded, so 1.2. looks like > "1.2. ". For me, 12.12. works, but any shorter one fails. Unless > you need space padding elsewhere, you may just want to use varchar(6); Also, the backslash has to be doubled to get through the string literal parser, so what you really want is id1 varchar(6) NOT NULL CHECK(id1 ~* '^([0-9]{1,2}\\.){2}$'), else it will accept values you don't want... regards, tom lane