Re: regexp_matches where clause - PG 9.1

Поиск
Список
Период
Сортировка
От Patrick B
Тема Re: regexp_matches where clause - PG 9.1
Дата
Msg-id CAJNY3isW5Sn8w81JWcndouEqVqDx5JFd3notG_2Ei6=_DZXH0A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: regexp_matches where clause - PG 9.1  (Arjen Nienhuis <a.g.nienhuis@gmail.com>)
Список pgsql-general

2017-04-06 17:35 GMT+12:00 Arjen Nienhuis <a.g.nienhuis@gmail.com>:


On Apr 6, 2017 05:57, "Patrick B" <patrickbakerbr@gmail.com> wrote:
Hi guys,

i've got this column:

path_name character varying(255)

I store full S3 bucket path for the attachments of my application on it; example:

/{s3bucket}/filesuser/client/27801123/attachment/4510/main
/{s3bucket}/filesuser/client/27801123/attachment/4510/file


I wanna do a select, where path_name has only 'main' and not anything else.

WHERE path_nane LIKE '%/main'




I was able to do it like this:


WHERE (path_name)::text ~ '^\/filesuser\/client/\d+/(attachment)/\d+/(main)+'


Thanks
Patrick. 

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

Предыдущее
От: Arjen Nienhuis
Дата:
Сообщение: Re: regexp_matches where clause - PG 9.1
Следующее
От: Ertan Küçükoğlu
Дата:
Сообщение: Re: Advise on primary key for detail tables (OS: Raspberry Pi)