Re: The COPY command and csv files - Mailing list pgsql-novice

From Tom Lane
Subject Re: The COPY command and csv files
Date
Msg-id 18175.1145388404@sss.pgh.pa.us
Whole thread Raw
In response to Re: The COPY command and csv files  ("Eric Matthew Finnin" <emf.storage@gmail.com>)
List pgsql-novice
"Eric Matthew Finnin" <emf.storage@gmail.com> writes:
> Apparently, you can't use the COPY command to copy a whole file
> without being a super user?

You can, but not like that.  The point of the restriction is that the
database may be running on a different machine from where the user is,
and non-superusers shouldn't have access to the filesystem that the
database can see.  "COPY FROM 'filename'" is a server-side operation
and reads the server's filesystem, so it's allowed only to superusers.

However, psql (and probably most other client-side tools) have a way
to read from the client's filesystem and shove the data across the
network to a COPY FROM STDIN command.  In psql what you want is to
use the \copy command --- see the psql reference page for details.

            regards, tom lane

pgsql-novice by date:

Previous
From: George Young
Date:
Subject: Re: Find all foreign keys and dropping them from a script.
Next
From: "Reza Razavipour"
Date:
Subject: Maximum database size