Creating or modifying a tsquery from PL/pgSQL

Поиск
Список
Период
Сортировка
От Tobia Conforto
Тема Creating or modifying a tsquery from PL/pgSQL
Дата
Msg-id 65CA8C0E-1BF2-48F4-854D-402307064FC5@gruppo4.eu
обсуждение исходный текст
Список pgsql-general
I'd like to convert a plain search string into a tsquery, much like plainto_tsquery(), but enabling prefix searches
(:*)for every word. 

I've come up with this:

select regexp_replace(
           plainto_tsquery('english', 'text to search')::text,
           '''(?= |$)', ''':*', 'g'
       )::tsquery;
--> 'text':* & 'search':*

Is this the best way to do it, without writing C code? Can I otherwise manipulate the tsquery data structure from
PL/pgSQLwithout converting it to/from text? Would you recommend a different approach? 

-Tobia

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

Предыдущее
От: Vick Khera
Дата:
Сообщение: Re: Table ordering in pg_dump
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: Question about RUM-index