Re: PQexecParams, placeholders and variable lists of params

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PQexecParams, placeholders and variable lists of params
Дата
Msg-id 4176869.1637682183@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: PQexecParams, placeholders and variable lists of params  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: PQexecParams, placeholders and variable lists of params
Re: PQexecParams, placeholders and variable lists of params
Список pgsql-general
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tue, Nov 23, 2021 at 7:21 AM <tomas@tuxteam.de> wrote:
>> Makes sense. Problem is, that, again, the application would be
>> responsible of making sure the individual values don't contain nasty
>> stuff (for example, if they are strings) before consolidating them to
>> one PostgreSQL array literal.

> So long as you actually pass the literal value via a parameter the worst
> problem you can have is a syntax error in converting the literal into
> whatever type is being cast to.

PG's array quoting rules are odd enough that I can sympathize with not
wanting to deal with them.  (Although, if you only have to build an
array and not parse one, taking the always-quote-even-if-not-necessary
approach makes it easier.)

I don't see many other alternatives though.  *Somehow* you have to
separate one value from the next.  If you don't want to pass 'em as
distinct parameters, then you have to obey some kind of composite-value
syntax.

            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: PQexecParams, placeholders and variable lists of params
Следующее
От: tomas@tuxteam.de
Дата:
Сообщение: Re: PQexecParams, placeholders and variable lists of params