| От | Tom Lane |
|---|---|
| Тема | Re: Regexp matching + typecasts |
| Дата | |
| Msg-id | 12065.1395668842@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Regexp matching + typecasts (Ilya Ivanov <forn@ngs.ru>) |
| Ответы |
Re: Regexp matching + typecasts
|
| Список | pgsql-general |
Ilya Ivanov <forn@ngs.ru> writes:
> I need to find all active (status=0) items not belonging to any active
> trigger. The best I could come up with is this:
> select count(itemid) from items where status='0' and itemid not in (select
> cast(regexp_matches(expression,'{([^}]+)}','g') as integer) from triggers
> where status='0');
> However, the cast doesn't work:
> ERROR: cannot cast type text[] to integer
Well, yeah. You need to convert the possibly-multiple match results into
a set. Try putting unnest() around the regexp_matches call.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера