Re: find a substring on a text (data type) column

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: find a substring on a text (data type) column
Дата
Msg-id CAFj8pRC16-CSa3Q-fcAg4Nuf3Y03vT-tHptizJH=itYwn2W6xA@mail.gmail.com
обсуждение исходный текст
Ответ на find a substring on a text (data type) column  (pantelis vlachos <vlachos83@gmail.com>)
Список pgsql-general
Hello

2012/11/8 pantelis vlachos <vlachos83@gmail.com>:
> I was trying to find a substring on a text (data type) column like 'cat foo
> dog ...'.
> I use the query below
> SELECT id FROM table WHERE name LIKE '% foo %';
> Sometimes the query return with nTuples=0 but there are matching rows.
> On retry, the query return with expected results. Any ideas;

isn't problem in spaces, so LIKE '% foo %' must fail when symbol is on
begin or end?

you can check ' ' || name || ' ' LIKE '% foo %'

or better - use fulltext instead

Regards

Pavel Stehule

>
> (postgres ver 9.2, libpq - C Library)


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

Предыдущее
От: pantelis vlachos
Дата:
Сообщение: find a substring on a text (data type) column
Следующее
От: Marko Kreen
Дата:
Сообщение: Re: Comparing txid_current() to xmin