Re: Allow COPY to use parameters

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Allow COPY to use parameters
Дата
Msg-id CAKFQuwYu97aOvpunL4+BKrYzWOGoUFriHdBnv97djt5-Ar_28Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Allow COPY to use parameters  (Craig Ringer <craig@2ndquadrant.com>)
Ответы Re: Allow COPY to use parameters  (Corey Huinker <corey.huinker@gmail.com>)
Список pgsql-hackers
On Fri, May 27, 2016 at 6:02 AM, Craig Ringer <craig@2ndquadrant.com> wrote:

    COPY FROM $1 TO 'myfilename'


​Random thought - how about at least making the following work:

For the following pretend that "STRING" has the same behavior as the "format(...)" function.

EXECUTE STRING('COPY %I TO %L', 'testtable', 'testfile.txt');​

<(conceptually similar to: EXECUTE format(​'COPY %I TO %L', 'testtable', 'testfile.txt')>

​This doesn't solve the knowledge problem ​but at least provides an idiomatic way to execute dynamic SQL without pl/pgsql and without forcing the client library to take responsibility for proper data massaging in order to eliminate sql injection.

As an extension making:

PREPARE name STRING('COPY %I TO %L', ?, ?);​

EXECUTE name STRING USING ('testtable', 'testfile.txt');

David J.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: COMMENT ON, psql and access methods
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <