Re: SELECT using RegEx inside a POSITION function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: SELECT using RegEx inside a POSITION function
Дата
Msg-id 9082.1051374362@sss.pgh.pa.us
обсуждение исходный текст
Ответ на SELECT using RegEx inside a POSITION function  ("Danny Stewart" <dstewart@pcfa.org>)
Список pgsql-novice
"Danny Stewart" <dstewart@pcfa.org> writes:
> I am trying to use
> SELECT substring(id from position(~ '[0-9]' in id)) FROM resources ;
> but that returns:
> Unable to identify a prefix operator '~' for type 'unknown'

I think you are mixing up substring() and position().  If I understand
your problem correctly, what you need is just the regex-style substring
function:

regression=# select substring('Folder 567 Section 6' from '[0-9]+');
 substring
-----------
 567
(1 row)

            regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: implicit lock in RULE ?
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Date format errors