cvs text to quoted cvs text

Поиск
Список
Период
Сортировка
От Michael Moore
Тема cvs text to quoted cvs text
Дата
Msg-id CACpWLjNzDmgZojHAFzN0b7V5grRSuUq9ehSMgPCFRM1zQEHhFQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: cvs text to quoted cvs text  (Igor Neyman <ineyman@perceptron.com>)
Re: cvs text to quoted cvs text  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-sql
I have some input parameters on a function that will by use in dynamic sql as part of an IN list. For example:
'select val from mytab where zzz in ('||csv_input_parm::text||')';
The problem is that csv_input_parm is formatted like:
[THIS,THAT,THE OTHER] while the IN list would need
['THIS','THAT','THE OTHER'] brackets not included.
I came up with this approach to do the conversion:
select ''''||array_to_string(string_to_array('THIS,THAT,THE OTHER',','),''',''')||'''' rslt
It gets the job done, but it's ugly. Is there a way that is not ugly?
thanks,
Mike
 

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

Предыдущее
От: Michael Moore
Дата:
Сообщение: Re: insert values from a ROW object
Следующее
От: Igor Neyman
Дата:
Сообщение: Re: cvs text to quoted cvs text