Re: Robust ways for checking allowed values in a column

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Robust ways for checking allowed values in a column
Дата
Msg-id CAKFQuwbhKUsPXwPvoPnh2Xv=g748y6UxigCOoNOUY=a7EhEv0Q@mail.gmail.com
обсуждение исходный текст
Ответ на Robust ways for checking allowed values in a column  (Shaozhong SHI <shishaozhong@gmail.com>)
Ответы Re: Robust ways for checking allowed values in a column  (Shaozhong SHI <shishaozhong@gmail.com>)
Список pgsql-general
On Tue, Jan 25, 2022 at 6:56 AM Shaozhong SHI <shishaozhong@gmail.com> wrote:
 select form from mytable  where form ~ '^Canal$|^Drain$|^Foreshore$|^inlandRiver$|^Lake$|^lockOrFlightOfLocks$|^Marsh$|^Researvoir$|^Sea$|^tidalRiver$|^Transfer$'

You do not need to repeat the boundary metacharacters on each branch.  You can assert their presence just once and then use parentheses to group the alternations.

form ~ '^(?Canal|Drain|etc...)$'

David J.

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

Предыдущее
От: Guillaume Lelarge
Дата:
Сообщение: Re: Robust ways for checking allowed values in a column
Следующее
От: Ray O'Donnell
Дата:
Сообщение: Re: Robust ways for checking allowed values in a column