]> granicus.if.org Git - postgresql/commitdiff
Message style improvements
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 4 Aug 2017 22:31:01 +0000 (18:31 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 4 Aug 2017 22:31:32 +0000 (18:31 -0400)
src/bin/pg_archivecleanup/pg_archivecleanup.c
src/bin/pg_basebackup/pg_receivewal.c
src/bin/pg_basebackup/receivelog.c
src/bin/pg_basebackup/walmethods.c
src/interfaces/libpq/fe-auth-scram.c
src/pl/plpython/expected/plpython_types.out
src/pl/plpython/expected/plpython_types_3.out
src/pl/plpython/plpy_typeio.c

index c5e344f3cf39959d6325c87fc698ecc38b6b2706..d017f5793ba32ae1702d35401e51f562d17e1939 100644 (file)
@@ -245,7 +245,7 @@ SetWALFileNameForCleanup(void)
 
        if (!fnameOK)
        {
-               fprintf(stderr, _("%s: invalid filename input\n"), progname);
+               fprintf(stderr, _("%s: invalid file name argument\n"), progname);
                fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
                exit(2);
        }
@@ -350,14 +350,14 @@ main(int argc, char **argv)
        }
        else
        {
-               fprintf(stderr, _("%s: must specify restartfilename\n"), progname);
+               fprintf(stderr, _("%s: must specify oldest kept WAL file\n"), progname);
                fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
                exit(2);
        }
 
        if (optind < argc)
        {
-               fprintf(stderr, _("%s: too many parameters\n"), progname);
+               fprintf(stderr, _("%s: too many command-line arguments\n"), progname);
                fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname);
                exit(2);
        }
@@ -376,7 +376,7 @@ main(int argc, char **argv)
        {
                snprintf(WALFilePath, MAXPGPATH, "%s/%s",
                                 archiveLocation, exclusiveCleanupFileName);
-               fprintf(stderr, _("%s: keep WAL file \"%s\" and later\n"),
+               fprintf(stderr, _("%s: keeping WAL file \"%s\" and later\n"),
                                progname, WALFilePath);
        }
 
index f3c7668d50e8dab63089029ec63eee75826bd817..9ea61d5a5d4089151c22f9d2c1ac5892a6ee4a31 100644 (file)
@@ -280,7 +280,7 @@ FindStreamingStart(uint32 *tli)
                        }
                        if (lseek(fd, (off_t) (-4), SEEK_END) < 0)
                        {
-                               fprintf(stderr, _("%s: could not seek compressed file \"%s\": %s\n"),
+                               fprintf(stderr, _("%s: could not seek in compressed file \"%s\": %s\n"),
                                                progname, fullpath, strerror(errno));
                                disconnect_and_exit(1);
                        }
index 15932c60b5a7933ce4fdf2478ffc1949bbb2c11d..888458f4a901d775af6029849415f0ccc7c7829f 100644 (file)
@@ -136,7 +136,7 @@ open_walfile(StreamCtl *stream, XLogRecPtr startpoint)
                        if (stream->walmethod->sync(f) != 0)
                        {
                                fprintf(stderr,
-                                               _("%s: could not sync existing write-ahead log file \"%s\": %s\n"),
+                                               _("%s: could not fsync existing write-ahead log file \"%s\": %s\n"),
                                                progname, fn, stream->walmethod->getlasterror());
                                stream->walmethod->close(f, CLOSE_UNLINK);
                                return false;
@@ -151,7 +151,9 @@ open_walfile(StreamCtl *stream, XLogRecPtr startpoint)
                        if (errno == 0)
                                errno = ENOSPC;
                        fprintf(stderr,
-                                       _("%s: write-ahead log file \"%s\" has %d bytes, should be 0 or %d\n"),
+                                       ngettext("%s: write-ahead log file \"%s\" has %d byte, should be 0 or %d\n",
+                                                        "%s: write-ahead log file \"%s\" has %d bytes, should be 0 or %d\n",
+                                                        size),
                                        progname, fn, (int) size, XLogSegSize);
                        return false;
                }
index 2ab5ae93e09073553510d95ddaed26000e2f8eba..02d368b2427c7696286d6c68c712fa7079c5c817 100644 (file)
@@ -432,7 +432,7 @@ tar_write_compressed_data(void *buf, size_t count, bool flush)
                r = deflate(tar_data->zp, flush ? Z_FINISH : Z_NO_FLUSH);
                if (r == Z_STREAM_ERROR)
                {
-                       tar_set_error("deflate failed");
+                       tar_set_error("could not compress data");
                        return false;
                }
 
@@ -456,7 +456,7 @@ tar_write_compressed_data(void *buf, size_t count, bool flush)
                /* Reset the stream for writing */
                if (deflateReset(tar_data->zp) != Z_OK)
                {
-                       tar_set_error("deflateReset failed");
+                       tar_set_error("could not reset compression stream");
                        return false;
                }
        }
@@ -557,7 +557,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
                        {
                                pg_free(tar_data->zp);
                                tar_data->zp = NULL;
-                               tar_set_error("deflateInit2 failed");
+                               tar_set_error("could not initialize compression library");
                                return NULL;
                        }
                }
@@ -569,7 +569,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
        Assert(tar_data->currentfile == NULL);
        if (tar_data->currentfile != NULL)
        {
-               tar_set_error("implementation error: tar files can't have more than one open file\n");
+               tar_set_error("implementation error: tar files can't have more than one open file");
                return NULL;
        }
 
@@ -597,7 +597,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
                /* Turn off compression for header */
                if (deflateParams(tar_data->zp, 0, 0) != Z_OK)
                {
-                       tar_set_error("deflateParams failed");
+                       tar_set_error("could not change compression parameters");
                        return NULL;
                }
        }
@@ -635,7 +635,7 @@ tar_open_for_write(const char *pathname, const char *temp_suffix, size_t pad_to_
                /* Re-enable compression for the rest of the file */
                if (deflateParams(tar_data->zp, tar_data->compression, 0) != Z_OK)
                {
-                       tar_set_error("deflateParams failed");
+                       tar_set_error("could not change compression parameters");
                        return NULL;
                }
        }
@@ -824,7 +824,7 @@ tar_close(Walfile f, WalCloseMethod method)
                /* Turn off compression */
                if (deflateParams(tar_data->zp, 0, 0) != Z_OK)
                {
-                       tar_set_error("deflateParams failed");
+                       tar_set_error("could not change compression parameters");
                        return -1;
                }
 
@@ -835,7 +835,7 @@ tar_close(Walfile f, WalCloseMethod method)
                /* Turn compression back on */
                if (deflateParams(tar_data->zp, tar_data->compression, 0) != Z_OK)
                {
-                       tar_set_error("deflateParams failed");
+                       tar_set_error("could not change compression parameters");
                        return -1;
                }
        }
@@ -901,7 +901,7 @@ tar_finish(void)
 
                        if (r == Z_STREAM_ERROR)
                        {
-                               tar_set_error("deflate failed");
+                               tar_set_error("could not compress data");
                                return false;
                        }
                        if (tar_data->zp->avail_out < ZLIB_OUT_SIZE)
@@ -917,7 +917,7 @@ tar_finish(void)
 
                if (deflateEnd(tar_data->zp) != Z_OK)
                {
-                       tar_set_error("deflateEnd failed");
+                       tar_set_error("could not close compression stream");
                        return false;
                }
        }
index 8c5c3148c570d4db69ddf13047e5f08807ce5aa6..d1c70371014a3d0ed1668f48f94a0eae39d35616 100644 (file)
@@ -308,7 +308,7 @@ build_client_first_message(fe_scram_state *state, PQExpBuffer errormessage)
        if (!pg_frontend_random(raw_nonce, SCRAM_RAW_NONCE_LEN))
        {
                printfPQExpBuffer(errormessage,
-                                                 libpq_gettext("failed to generate nonce\n"));
+                                                 libpq_gettext("could not generate nonce\n"));
                return NULL;
        }
 
index 10f7125d8417757383c5c58ab983f90ec6afd898..893de301ddaffeb513b3601ec6650c27a43703b6 100644 (file)
@@ -691,7 +691,8 @@ CREATE FUNCTION test_type_conversion_mdarray_malformed() RETURNS int[] AS $$
 return [[1,2,3],[4,5]]
 $$ LANGUAGE plpythonu;
 SELECT * FROM test_type_conversion_mdarray_malformed();
-ERROR:  multidimensional arrays must have array expressions with matching dimensions. PL/Python function return value has sequence length 2 while expected 3
+ERROR:  wrong length of inner sequence: has length 2, but 3 was expected
+DETAIL:  To construct a multidimensional array, the inner sequences must all have the same length.
 CONTEXT:  while creating return value
 PL/Python function "test_type_conversion_mdarray_malformed"
 CREATE FUNCTION test_type_conversion_mdarray_toodeep() RETURNS int[] AS $$
index f7f0d31fef8edb6d29679c5a4b004dadb9942434..2d853bd5731771f81d07c91e4340f6b36513c240 100644 (file)
@@ -691,7 +691,8 @@ CREATE FUNCTION test_type_conversion_mdarray_malformed() RETURNS int[] AS $$
 return [[1,2,3],[4,5]]
 $$ LANGUAGE plpython3u;
 SELECT * FROM test_type_conversion_mdarray_malformed();
-ERROR:  multidimensional arrays must have array expressions with matching dimensions. PL/Python function return value has sequence length 2 while expected 3
+ERROR:  wrong length of inner sequence: has length 2, but 3 was expected
+DETAIL:  To construct a multidimensional array, the inner sequences must all have the same length.
 CONTEXT:  while creating return value
 PL/Python function "test_type_conversion_mdarray_malformed"
 CREATE FUNCTION test_type_conversion_mdarray_toodeep() RETURNS int[] AS $$
index 4dfa3e8f915bc7ce308aedfcd0709499d063c456..91ddcaa7b9ce26ad16ebe7f20662a0150ca3c4e0 100644 (file)
@@ -1002,7 +1002,7 @@ PLySequence_ToArray(PLyObToDatum *arg, int32 typmod, PyObject *plrv, bool inarra
 
                dims[ndim] = PySequence_Length(pyptr);
                if (dims[ndim] < 0)
-                       PLy_elog(ERROR, "cannot determine sequence length for function return value");
+                       PLy_elog(ERROR, "could not determine sequence length for function return value");
 
                if (dims[ndim] > MaxAllocSize)
                        PLy_elog(ERROR, "array size exceeds the maximum allowed");
@@ -1087,10 +1087,10 @@ PLySequence_ToArray_recurse(PLyObToDatum *elm, PyObject *list,
        int                     i;
 
        if (PySequence_Length(list) != dims[dim])
-               PLy_elog(ERROR,
-                                "multidimensional arrays must have array expressions with matching dimensions. "
-                                "PL/Python function return value has sequence length %d while expected %d",
-                                (int) PySequence_Length(list), dims[dim]);
+               ereport(ERROR,
+                               (errmsg("wrong length of inner sequence: has length %d, but %d was expected",
+                                               (int) PySequence_Length(list), dims[dim]),
+                                (errdetail("To construct a multidimensional array, the inner sequences must all have the same length."))));
 
        if (dim < ndim - 1)
        {