Re: Regular expression validation

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Regular expression validation
Дата
Msg-id 20020719044453.K81292-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на Regular expression validation  (Jakub Ouhrabka <jouh8664@ss1000.ms.mff.cuni.cz>)
Список 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)



В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: COMMIT in PostgreSQL
Следующее
От: Stephane Bortzmeyer
Дата:
Сообщение: Looking for types: phone number, email addresses