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 \COPY command at all! Could you please 
guide me briefly on how to use \COPY command for my usage to write the output 
into a .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


--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to