Use "data directory" not "current directory" in error messages.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Mar 2023 16:04:08 +0000 (12:04 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 16 Mar 2023 16:04:08 +0000 (12:04 -0400)
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

contrib/adminpack/adminpack.c
contrib/adminpack/expected/adminpack.out
src/backend/utils/adt/genfile.c

index 357b671a6c65cd2f623e8e6104c6cd94529313c2..d3aec7b685b477bd3665847b73fc1ddd6d524f80 100644 (file)
@@ -97,7 +97,7 @@ convert_and_check_filename(text *arg)
    else if (!path_is_relative_and_below_cwd(filename))
        ereport(ERROR,
                (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-                errmsg("path must be in or below the current directory")));
+                errmsg("path must be in or below the data directory")));
 
    return filename;
 }
index 6bcf2217f252540fa8d4b811af6f8e3d37b6634e..f419a5ea1dff51ebfc63ac77af392d92643d3d0c 100644 (file)
@@ -41,7 +41,7 @@ GRANT pg_read_all_settings TO regress_adminpack_user1;
 GRANT EXECUTE ON FUNCTION pg_file_write(text,text,bool) TO regress_adminpack_user1;
 SET ROLE regress_adminpack_user1;
 SELECT pg_file_write('../test_file0', 'test0', false);
-ERROR:  path must be in or below the current directory
+ERROR:  path must be in or below the data directory
 SELECT pg_file_write('/tmp/test_file0', 'test0', false);
 ERROR:  absolute path not allowed
 SELECT pg_file_write(current_setting('data_directory') || '/test_file4', 'test4', false);
index 75588eebb343ca6c405f90e6c2c523a8b2738ddf..f281ce98068d3e14dfdeab765453d4fba72d4412 100644 (file)
@@ -86,7 +86,7 @@ convert_and_check_filename(text *arg)
    else if (!path_is_relative_and_below_cwd(filename))
        ereport(ERROR,
                (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
-                errmsg("path must be in or below the current directory")));
+                errmsg("path must be in or below the data directory")));
 
    return filename;
 }