Re: [GENERAL] Re: Is it possible to specify an ESCAPE for a wildcardsearch using LIKE ANY (...)

Поиск
Список
Период
Сортировка
От Karsten Hilbert
Тема Re: [GENERAL] Re: Is it possible to specify an ESCAPE for a wildcardsearch using LIKE ANY (...)
Дата
Msg-id 20170117144919.vtgf462vtfmddo2v@hermes.hilbert.loc
обсуждение исходный текст
Ответ на [GENERAL] Re: Is it possible to specify an ESCAPE for a wildcard search usingLIKE ANY (...)  (Thomas Kellerer <spam_eater@gmx.net>)
Список pgsql-general
On Tue, Jan 17, 2017 at 03:27:57PM +0100, Thomas Kellerer wrote:

>> Do you need to have the _ NOT be recognized as a wildcard ?
>
> Yes, the underscore should NOT be a wildcard in this case.

Understood.

So, as Tom hinted at, your best bet might be to write a

    function escape_underscore_in_1dim_text_array(IN TEXT[], OUT TEXT[])
        ...

which takes an array and puts '\' in front of every '_' of
each member such that you can write

    ... like any (escape_underscore_in_1dim_text_array(your_array)) ...

Would that solve the problem ?

(this assume *no* underscore is to be a wildcard in user
provided input, not just some)

Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


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

Предыдущее
От: Thomas Kellerer
Дата:
Сообщение: [GENERAL] Re: Is it possible to specify an ESCAPE for a wildcard search usingLIKE ANY (...)
Следующее
От: Andrew Kerber
Дата:
Сообщение: [GENERAL] Largepages in Windows