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