From: | Bill Moran <wmoran(at)collaborativefusion(dot)com> |
---|---|
To: | "Tomas Lanczos" <lanczos(at)t-zones(dot)sk> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: could not open file xxxx for writing: Permission |
Date: | 2007-01-04 11:46:03 |
Message-ID: | 20070104064603.03acd0a5.wmoran@collaborativefusion.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Tomas Lanczos" <lanczos(at)t-zones(dot)sk> wrote:
>
> Hello,
>
> Using PostgreSQL 8.1.4, pgadmin III 1.6.0 in WinXP I tried to export a table
> using COPY (first time in postgresql, did many times in Sybase):
>
> COPY ml50jtsk_datum_v TO 'c:/postgresql/ml50jtsk.out';
>
> I got the following errormessage:
>
> ERROR: could not open file "c:/postgresql/ml50jtsk.out" for writing:
> Permission denied
> SQL state: 42501
>
> What's wrong? Does it mean that the database user has no writing permission
> out of the database? How I did a pg_dump then few weeks ago?
When you run a pg_dump, the file is created with the perms of the user
calling the pg_dump program.
When you do a "copy", the file is created with the perms of the user
running the PostgreSQL _server_ process. Probably a user called
"postgres".
If the user the server runs as doesn't have permission to write to the
specified directory, you'll see this error.
As Magnus stated, you can do \copy, which executes the copy command in
the the client instead of in the server, and it will have the perms of
the user who started the client -- assuming you're using the psql
program.
You can also change that directory's perms to allow the server user to
write to it, or choose a directory that the server user already has
rights to.
HTH,
Bill
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2007-01-04 12:07:53 | Re: Tabbed data in tab-separated output |
Previous Message | Grzegorz Nowakowski | 2007-01-04 11:15:03 | Table inheritance implementation. |