@@ -83,7 +83,9 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
8383 if (!has_privs_of_role (GetUserId (), ROLE_PG_EXECUTE_SERVER_PROGRAM ))
8484 ereport (ERROR ,
8585 (errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
86- errmsg ("must be superuser or have privileges of the pg_execute_server_program role to COPY to or from an external program" ),
86+ errmsg ("permission denied to COPY to or from an external program" ),
87+ errdetail ("Only roles with privileges of the \"%s\" role may COPY to or from an external program." ,
88+ "pg_execute_server_program" ),
8789 errhint ("Anyone can COPY to stdout or from stdin. "
8890 "psql's \\copy command also works for anyone." )));
8991 }
@@ -92,14 +94,18 @@ DoCopy(ParseState *pstate, const CopyStmt *stmt,
9294 if (is_from && !has_privs_of_role (GetUserId (), ROLE_PG_READ_SERVER_FILES ))
9395 ereport (ERROR ,
9496 (errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
95- errmsg ("must be superuser or have privileges of the pg_read_server_files role to COPY from a file" ),
97+ errmsg ("permission denied to COPY from a file" ),
98+ errdetail ("Only roles with privileges of the \"%s\" role may COPY from a file." ,
99+ "pg_read_server_files" ),
96100 errhint ("Anyone can COPY to stdout or from stdin. "
97101 "psql's \\copy command also works for anyone." )));
98102
99103 if (!is_from && !has_privs_of_role (GetUserId (), ROLE_PG_WRITE_SERVER_FILES ))
100104 ereport (ERROR ,
101105 (errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
102- errmsg ("must be superuser or have privileges of the pg_write_server_files role to COPY to a file" ),
106+ errmsg ("permission denied to COPY to a file" ),
107+ errdetail ("Only roles with privileges of the \"%s\" role may COPY to a file." ,
108+ "pg_write_server_files" ),
103109 errhint ("Anyone can COPY to stdout or from stdin. "
104110 "psql's \\copy command also works for anyone." )));
105111 }
0 commit comments