Re: COPY permissions problem - Windows XP

From: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
To: "Nolen, Terry" <Terry(dot)Nolen(at)sabre(dot)com>
Cc: pgadmin-support(at)postgresql(dot)org
Subject: Re: COPY permissions problem - Windows XP
Date: 2005-12-27 19:31:34
Message-ID: 20051227193134.GL72143@decibel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

On Thu, Dec 22, 2005 at 08:53:42AM -0600, Nolen, Terry wrote:
> I'm trying to use the COPY command. I've tried executing it using
> pgadmin and pgsql and receive the same message about no read
> permissions. Here is the syntax?

I'm assuming you meant psql, not pgsql...

> COPY as_benchmark.midt FROM 'C:/postgres_data/midt_short.csv' WITH CSV
>
> Here is the error I receive.
>
> ERROR: could not open file "c:/postgres_data/midt_short.csv" for
> reading: Permission denied
>
> I understand that postgres must have access, but how do I make sure it
> is granted in Windows?

Probably through the GUI... I'm not a windows expert.

An alternative in psql would be:

\COPY ...

\COPY in psql is equivalent to COPY as_benchmark_midt FROM STDIN, with
psql then reading the file and piping it to the backend via standard in
(or whatever the equivalent is on Windows). This means that only the
psql session needs read access to the file, not the PostgreSQL backend.

> Fyi...the use of "/" or "\\" in Windows could use some documentation
> explaining the acceptable ways to use them.

Do you have any suggested wording and location in docs?

> Thx again,
>
> Terry Nolen
>
>
>
> -----Original Message-----
> From: Jim C. Nasby [mailto:decibel(at)decibel(dot)org]
> Sent: Wednesday, December 21, 2005 7:10 PM
> To: Nolen, Terry
> Cc: pgadmin-support(at)postgresql(dot)org
> Subject: Re: [pgadmin-support] COPY permissions problem - Windows XP
>
>
>
> On Wed, Dec 21, 2005 at 04:32:17PM -0600, Nolen, Terry wrote:
>
> > I'm new to postgresql and I'm trying to test the copy command with a
> csv
>
> > file. I keep getting an error which states that I don't have read
>
> > permissions.
>
> >
>
> > My database is owned by postgres, and I'm signed in as postgres. The
>
> > table that I'm placing the data into has a different owner. I've
> tried
>
> > changing privileges in windows to allow all access to everyone on this
>
> > machine access. I've even shared the machine with external users.
> I've
>
> > move the file to different directorys and created a tablespace with my
>
> > new table in it, into the postgres data directory.
>
> >
>
> > I see this type of error on many boards, but they tend to be with a
>
> > flavor of unix. I'm really not getting the premise behind what is
> going
>
> > on and why. Could you please assist?
>
>
>
> We need to know exactly what command you're trying to run, if it's in
>
> psql or something else, and the exact error message.
>
> --
>
> Jim C. Nasby, Database Architect decibel(at)decibel(dot)org
>
> Give your computer some brain candy! www.distributed.net Team #1828
>
>
>
> Windows: "Where do you want to go today?"
>
> Linux: "Where do you want to go tomorrow?"
>
> FreeBSD: "Are you guys coming, or what?"
>

--
Jim C. Nasby, Database Architect decibel(at)decibel(dot)org
Give your computer some brain candy! www.distributed.net Team #1828

Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"

In response to

Responses

Browse pgadmin-support by date

  From Date Subject
Next Message Hendrik-Jan Heins 2005-12-28 00:30:55 New file for Mandriva
Previous Message Andreas Pflug 2005-12-26 14:47:47 Re: PgAdmin uses wrong column for primary key