Search Postgresql Archives

Re: How to give \COPY inside a function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/16/11 8:07 AM, Siva Palanisamy wrote:

I want to \COPY over COPY command as I am not running as a super/admin user. How to add \COPY command inside a function.

The following statement inside a function throws error.

\COPY xsa.export_table TO 'export.csv' DELIMITERS ',' CSV HEADER

Errors are throwing at “\COPY” and no semi-colon at the end of the line. Please guide me.


\COPY is a psql metacommand, not a proper SQL command, its translated to a SQL COPY command. you can't use \ commands in functions, so you'll need to recode that as a COPY ... TO STDOUT ...; and recieve the stdout stream and write it to your file (which is what the \COPY command is doing).



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast



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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux