Skip to content

Commit 2333803

Browse files
committed
Use "data directory" not "current directory" in error messages.
The user receiving the message might not understand where the server's "current directory" is. "Data directory" seems clearer. (This would not be good for frontend code, but both of these messages are only issued in the backend.) Kyotaro Horiguchi Discussion: https://postgr.es/m/20230316.111646.1564684434328830712.horikyota.ntt@gmail.com
1 parent 442f870 commit 2333803

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

contrib/adminpack/adminpack.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ convert_and_check_filename(text *arg)
9797
else if (!path_is_relative_and_below_cwd(filename))
9898
ereport(ERROR,
9999
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
100-
errmsg("path must be in or below the current directory")));
100+
errmsg("path must be in or below the data directory")));
101101

102102
return filename;
103103
}

contrib/adminpack/expected/adminpack.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ GRANT pg_read_all_settings TO regress_adminpack_user1;
4141
GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
4242
SET ROLE regress_adminpack_user1;
4343
SELECT pg_file_write('../test_file0', 'test0', false);
44-
ERROR: path must be in or below the current directory
44+
ERROR: path must be in or below the data directory
4545
SELECT pg_file_write('/tmp/test_file0', 'test0', false);
4646
ERROR: absolute path not allowed
4747
SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4', false);

src/backend/utils/adt/genfile.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ convert_and_check_filename(text *arg)
8686
else if (!path_is_relative_and_below_cwd(filename))
8787
ereport(ERROR,
8888
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
89-
errmsg("path must be in or below the current directory")));
89+
errmsg("path must be in or below the data directory")));
9090

9191
return filename;
9292
}

0 commit comments

Comments
 (0)