From: | Sharon Cowling <sharon(dot)cowling(at)sslnz(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Function problem |
Date: | 2002-01-17 21:42:00 |
Message-ID: | 200201172137.g0HLbmv02882@lambton.sslnz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I have a problem with a function containing the copy command.
The command below does exactly what I need it to do:
\COPY person2 TO '/usr/local/pgsql/report.csv' USING DELIMITERS ','
However I need this in a function to call from the front-end code, it creates fine but errors when I call it:
user=# CREATE FUNCTION getreport10() returns int as '
user'# BEGIN
user'# \COPY person2 TO ''/usr/local/pgsql/report.csv'' USING DELIMITERS '','';
user'# return 1;
user'# END;'
user-# LANGUAGE 'plpgsql';
CREATE
user=# select getreport10();
ERROR: You must have Postgres superuser privilege to do a COPY directly to or from a file. Anyone can COPY to stdout or from stdin. Psql's \copy command also works for anyone.
It does work if I give the user superuser privileges but I don't really want to do this!
Any suggestions?
Regards,
Sharon Cowling
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2002-01-17 21:46:52 | Re: Books on PostgreSQL |
Previous Message | Bruce Momjian | 2002-01-17 21:39:10 | Books on PostgreSQL |