]> granicus.if.org Git - postgresql/commitdiff
Unify error messages
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 24 Apr 2019 13:26:13 +0000 (09:26 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 24 Apr 2019 13:26:13 +0000 (09:26 -0400)
... for translatability purposes.

src/backend/storage/ipc/latch.c
src/backend/storage/ipc/signalfuncs.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/genfile.c
src/backend/utils/adt/json.c
src/backend/utils/adt/jsonb.c

index 59fa917ae044924ff93674a97c8403f7b396f0d4..e0712f906a1e51849fabf0f855fdb8c9129cc6d8 100644 (file)
@@ -856,7 +856,9 @@ WaitEventAdjustEpoll(WaitEventSet *set, WaitEvent *event, int action)
        if (rc < 0)
                ereport(ERROR,
                                (errcode_for_socket_access(),
-                                errmsg("epoll_ctl() failed: %m")));
+                                /* translator: %s is a syscall name, such as "poll()" */
+                                errmsg("%s failed: %m",
+                                               "epoll_ctl()")));
 }
 #endif
 
@@ -1087,7 +1089,9 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
                        waiting = false;
                        ereport(ERROR,
                                        (errcode_for_socket_access(),
-                                        errmsg("epoll_wait() failed: %m")));
+                                        /* translator: %s is a syscall name, such as "poll()" */
+                                        errmsg("%s failed: %m",
+                                                       "epoll_wait()")));
                }
                return 0;
        }
@@ -1211,7 +1215,9 @@ WaitEventSetWaitBlock(WaitEventSet *set, int cur_timeout,
                        waiting = false;
                        ereport(ERROR,
                                        (errcode_for_socket_access(),
-                                        errmsg("poll() failed: %m")));
+                                        /* translator: %s is a syscall name, such as "poll()" */
+                                        errmsg("%s failed: %m",
+                                                       "poll()")));
                }
                return 0;
        }
index 4769b1b51eb365dd42618e34dabeb08758fbbfeb..4bfbd57464c201f1458f4726b0bdbf54bdfd9447 100644 (file)
@@ -181,7 +181,9 @@ pg_rotate_logfile(PG_FUNCTION_ARGS)
                ereport(ERROR,
                                (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
                                 (errmsg("must be superuser to rotate log files with adminpack 1.0"),
-                                 errhint("Consider using pg_logfile_rotate(), which is part of core, instead."))));
+                                 /* translator: %s is a SQL function name */
+                                 errhint("Consider using %s, which is part of core, instead.",
+                                                 "pg_logfile_rotate()"))));
 
        if (!Logging_collector)
        {
index df1db7bc9f10827e0d22c57aa678bb366370652c..69a691f18e780de16d696afacfd275c81722ef6d 100644 (file)
@@ -1566,7 +1566,8 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
                                 */
                                ereport(ERROR,
                                                (errcode(ERRCODE_INDETERMINATE_COLLATION),
-                                                errmsg("could not determine which collation to use for lower() function"),
+                                                errmsg("could not determine which collation to use for %s function",
+                                                               "lower()"),
                                                 errhint("Use the COLLATE clause to set the collation explicitly.")));
                        }
                        mylocale = pg_newlocale_from_collation(collid);
@@ -1688,7 +1689,8 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
                                 */
                                ereport(ERROR,
                                                (errcode(ERRCODE_INDETERMINATE_COLLATION),
-                                                errmsg("could not determine which collation to use for upper() function"),
+                                                errmsg("could not determine which collation to use for %s function",
+                                                               "upper()"),
                                                 errhint("Use the COLLATE clause to set the collation explicitly.")));
                        }
                        mylocale = pg_newlocale_from_collation(collid);
@@ -1811,7 +1813,8 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
                                 */
                                ereport(ERROR,
                                                (errcode(ERRCODE_INDETERMINATE_COLLATION),
-                                                errmsg("could not determine which collation to use for initcap() function"),
+                                                errmsg("could not determine which collation to use for %s function",
+                                                               "initcap()"),
                                                 errhint("Use the COLLATE clause to set the collation explicitly.")));
                        }
                        mylocale = pg_newlocale_from_collation(collid);
index d69766099684353ff048a91a4d727a77b03e41be..a3c6adaf64019014feac82726bd45b0215b1ba64 100644 (file)
@@ -219,7 +219,9 @@ pg_read_file(PG_FUNCTION_ARGS)
                ereport(ERROR,
                                (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
                                 (errmsg("must be superuser to read files with adminpack 1.0"),
-                                 errhint("Consider using pg_file_read(), which is part of core, instead."))));
+                                 /* translator: %s is a SQL function name */
+                                 errhint("Consider using %s, which is part of core, instead.",
+                                                 "pg_file_read()"))));
 
        /* handle optional arguments */
        if (PG_NARGS() >= 3)
index de0d0723b7179ed8cf50da7091fb9e44d2b72a77..bb4bac85f7d1087c69d06aa1fa744952c9111734 100644 (file)
@@ -2192,7 +2192,9 @@ json_build_object(PG_FUNCTION_ARGS)
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                 errmsg("argument list must have even number of elements"),
-                                errhint("The arguments of json_build_object() must consist of alternating keys and values.")));
+                                /* translator: %s is a SQL function name */
+                                errhint("The arguments of %s must consist of alternating keys and values.",
+                                                "json_build_object()")));
 
        result = makeStringInfo();
 
index 7af4091200b56048bb6da632696d67e1f8745165..036d771386f5d727508c4de720d3e7da7e1d82b8 100644 (file)
@@ -1155,7 +1155,9 @@ jsonb_build_object(PG_FUNCTION_ARGS)
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
                                 errmsg("argument list must have even number of elements"),
-                                errhint("The arguments of jsonb_build_object() must consist of alternating keys and values.")));
+                                /* translator: %s is a SQL function name */
+                                errhint("The arguments of %s must consist of alternating keys and values.",
+                                                "jsonb_build_object()")));
 
        memset(&result, 0, sizeof(JsonbInState));