From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Jakub Ouhrabka <jouh8664(at)ss1000(dot)ms(dot)mff(dot)cuni(dot)cz> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Regular expression validation |
Date: | 2002-07-19 11:47:09 |
Message-ID: | 20020719044453.K81292-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, 19 Jul 2002, Jakub Ouhrabka wrote:
> is there any function in postgresql saying me if the given regular
> expression is valid? I store regular expressions in a table and then
> perform some searches using ~* operator. But when the stored regular
> expression is invalid (eg '+') then the query with ~* fails (ERROR:
> Invalid regular expression: ?, *, or + operand invalid.) I'd like to have
> a check constraint on that column storing regular expressions, so that no
> one can insert invalid data and cause failing of other queries... Is there
> any simple way?
Hmm, maybe something like
CHECK (('' ~* col) or (not ('' ~* col)) or (col is null))
(remove the last part if you don't want nulls)
From | Date | Subject | |
---|---|---|---|
Next Message | Stephane Bortzmeyer | 2002-07-19 11:52:37 | Looking for types: phone number, email addresses |
Previous Message | Martijn van Oosterhout | 2002-07-19 11:37:35 | Re: COMMIT in PostgreSQL |