On 11/08/2011 7:56 PM, Siva Palanisamy wrote:

> FYI, I am using PostgreSQL 8.1.4.

Argh, ogod why?!?!?!

That version is *totally* unsupported on Windows. Not only that, but you're running an ancient point-release - you are missing *19* patch releases worth of bug fixes. The latest point-release is 8.1.23 !

Here is a list of all the fixes you are missing out on:

  http://www.postgresql.org/docs/8.1/static/release.html

I have installed Windows version of Postgres 9.0.4 in my windows machine to 
test the new copy command as detailed in the below e-mails. When I run the 
command in SQL Editor, I got permission error. But I am running as an 
administrator.

COMMAND: copy (select * from employee) to 'C:/emp.csv'
ERROR:  could not open file "C:/emp.csv" for writing: Permission denied
********** Error **********
ERROR: could not open file "C:/emp.csv" for writing: Permission denied
SQL state: 42501

The COPY command (as distinct from \copy) runs on the server-side so it has the permissions of the "postgres" user. You must save the file somewhere the "postgres" user as write access. Either create a folder and give "full control" to the user "postgres", or write the export within the existing postgresql data directory.

COMMAND: \copy (select * from employee) to 'C:/emp.csv'
ERROR:  syntax error at or near "\"
LINE 1: \copy (select * from employee) to 'C:/emp.csv'

You are not using psql. "\copy" is a psql command. I don't think it's supported by PgAdmin III, though I could be wrong.



--
Craig Ringer

--
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