Function problem

Поиск
Список
Период
Сортировка
От Sharon Cowling
Тема Function problem
Дата
Msg-id 200201172137.g0HLbmv02882@lambton.sslnz.com
обсуждение исходный текст
Список 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
orfrom 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


В списке pgsql-general по дате отправления:

Предыдущее
От: Neil Conway
Дата:
Сообщение: Re: Is It Too Big ? - Customer Data Warehouse Growth
Следующее
От: Bruce Momjian
Дата:
Сообщение: Books on PostgreSQL