From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Chema <chema(at)interneta(dot)org> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: "permission denied to COPY to or from an external program" even with GRANT pg_execute_server_program |
Date: | 2024-06-13 01:48:06 |
Message-ID: | 1709907.1718243286@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Chema <chema(at)interneta(dot)org> writes:
> been banging my head against this one for a couple days. Googling and
> StackExchange were just as useful, so you're my last hope. I've been
> unable to get a non-admin user to run Copy From Program even after granting
> pg_execute_server_program, and everything else I could think of. It always
> fails with ERROR: permission denied to COPY to or from an external program.
Works for me:
regression=# create user joe;
CREATE ROLE
regression=# \c - joe
You are now connected to database "regression" as user "joe".
regression=> create table jt (t1 text);
CREATE TABLE
regression=> copy jt From Program 'echo "Buffa Testata"' CSV;
ERROR: permission denied to COPY to or from an external program
DETAIL: Only roles with privileges of the "pg_execute_server_program" role may COPY to or from an external program.
HINT: Anyone can COPY to stdout or from stdin. psql's \copy command also works for anyone.
regression=> \c - postgres
You are now connected to database "regression" as user "postgres".
regression=# GRANT pg_execute_server_program TO joe;
GRANT ROLE
regression=# \c - joe
You are now connected to database "regression" as user "joe".
regression=> copy jt From Program 'echo "Buffa Testata"' CSV;
COPY 1
What PG version are you working with?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Chema | 2024-06-13 01:53:43 | Re: "permission denied to COPY to or from an external program" even with GRANT pg_execute_server_program |
Previous Message | David G. Johnston | 2024-06-13 01:44:40 | Re: "permission denied to COPY to or from an external program" even with GRANT pg_execute_server_program |