From: | "Dawid Kuroczko" <qnex42(at)gmail(dot)com> |
---|---|
To: | Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Finding broken regex'es |
Date: | 2007-10-03 15:41:04 |
Message-ID: | 758d5e7f0710030841q68e332f6xd44a2675dd0f3994@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 10/3/07, Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com> wrote:
> 2007/10/3, Dawid Kuroczko <qnex42(at)gmail(dot)com>:
>
> > CREATE TABLE rx_check (
> > rx text CHECK ('' ~ rx IN ('t','f'))
> > );
>
> wow. This is beautiful :)
Personally I would wrap it around DOMAIN, i.e.:
CREATE DOMAIN regex AS
text CHECK ('' ~ VALUE IN (TRUE,FALSE));
And then use 'regex' type instead of 'text'. For a nice look&feel:
CREATE TABLE rx_test (
rx regex
);
qnex=>insert into rx_test values ('.*');
INSERT 0 1
qnex=>insert into rx_test values ('qwe');
INSERT 0 1
qnex=>insert into rx_test values ('aaa(aaa');
ERROR: invalid regular expression: parentheses () not balanced
From | Date | Subject | |
---|---|---|---|
Next Message | Hengky Lie | 2007-10-03 16:44:04 | Need help with CASE statement in Function |
Previous Message | Filip Rembiałkowski | 2007-10-03 14:40:35 | Re: Finding broken regex'es |