Re: Copy command to handle view for my export requirement

Поиск
Список
Период
Сортировка
От Raghavendra
Тема Re: Copy command to handle view for my export requirement
Дата
Msg-id CA+h6AhgvmgnHCs99XgExs1PgfkC4x3k0nv4jwycBsR4+BfQd-Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Copy command to handle view for my export requirement  (Siva Palanisamy <siva_p@hcl.com>)
Список pgsql-general
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

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'
       ^
********** Error **********
ERROR: syntax error at or near "\"
SQL state: 42601

Please correct me where I am going wrong. FYI, I am running under the administrator accounts of both Windows Login and PostgreSQL.

 
Two things,
1. you need to have a proper permissions where the .csv file creating.
2. In windows you need to use as below
postgres=#\copy (select * from employee) to 'C:\\emp.sql' 
 
Regards,
Raghavendra
EnterpriseDB Corporation

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

Предыдущее
От: Siva Palanisamy
Дата:
Сообщение: Re: Copy command to handle view for my export requirement
Следующее
От: Craig Ringer
Дата:
Сообщение: Re: Copy command to handle view for my export requirement