`must be superuser to COPY to or from a file' - using perl DBI - approaches to work around this - Mailing list pgsql-general

From Dan Kortschak
Subject `must be superuser to COPY to or from a file' - using perl DBI - approaches to work around this
Date
Msg-id 1255392899.3427.10.camel@zoidberg.mbs.adelaide.edu.au
Whole thread Raw
Responses Re: `must be superuser to COPY to or from a file' - using perl DBI - approaches to work around this
List pgsql-general
Hi,

I'm using the perl DBI module to interface with Pg, generating a number
of tables and then loading them into a postgres database (this is to
automate a previously psql-based setup).

One instance of loading the data looks like this, but I am only able to
do this as a superuser (this is possible for me, but I would like to
avoid it):

$dbh->do("COPY chromosome_data FROM '".chromosomes(\%options)."' CSV");

Now either I can call psql from perl (missing the point of using DBI), I
can make the user a superuser (which I would like to avoid for safety
reasons) or I can try to figure out some way of IPC to get STDOUT from
the perl to be read into postgres via STDIN (this seems unnecessarily
complicated).

Does anyone have any suggestions (the least bad of the options above
seems to be to use psql, but I think that is ugly)?

Also, can anyone suggest why it is possible to create a database but not
COPY to/from a file as a non-superuser?

thanks
Dan



pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Nested transactions
Next
From: Stephen Frost
Date:
Subject: Re: `must be superuser to COPY to or from a file' - using perl DBI - approaches to work around this