Re: How to give \COPY inside a function
От | John R Pierce |
---|---|
Тема | Re: How to give \COPY inside a function |
Дата | |
Msg-id | 4E4B520B.4080705@hogranch.com обсуждение исходный текст |
Ответ на | Re: How to give \COPY inside a function (Siva Palanisamy <siva_p@hcl.com>) |
Список | pgsql-general |
On 08/16/11 10:03 PM, Siva Palanisamy wrote: > Hi John, > > I would like to add that I was not given the super user privilege to perform COPY command. If so, I wouldn't see \COPYcommand at all! Could you please guide me briefly on how to use \COPY command for my usage to write the output intoa .CSV file inside a function? a postgres function can not write a file, but it can execute a COPY .... TO STDOUT ...; without superuser privilege. your invoking application program would use whatever function in its Postgres binding to read this 'stdout' data (its not really stdout), like in C/C++ with libpq.so, you would use PQgetCopyData http://www.postgresql.org/docs/current/static/libpq-copy.html#LIBPQ-COPY-RECEIVE to receive this data stream, which you would write to a file via your application -- john r pierce N 37, W 122 santa cruz ca mid-left coast
В списке pgsql-general по дате отправления: