]> granicus.if.org Git - postgresql/commitdiff
Assorted translatable string fixes
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Sun, 4 Jun 2017 15:41:16 +0000 (11:41 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Sun, 4 Jun 2017 15:41:16 +0000 (11:41 -0400)
Mark our rusage reportage string translatable; remove quotes from type
names; unify formatting of very similar messages.

src/backend/access/brin/brin_pageops.c
src/backend/catalog/index.c
src/backend/catalog/namespace.c
src/backend/commands/vacuumlazy.c
src/backend/commands/variable.c
src/backend/storage/page/bufpage.c
src/backend/utils/adt/json.c
src/backend/utils/adt/jsonb.c
src/backend/utils/misc/pg_rusage.c

index 1725591b0515e69bb838bd39833994bd28728c73..27e04cd34bae0c692459ad32d32663ede96a0884 100644 (file)
@@ -73,10 +73,8 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange,
        {
                ereport(ERROR,
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-                       errmsg("index row size %lu exceeds maximum %lu for index \"%s\"",
-                                  (unsigned long) newsz,
-                                  (unsigned long) BrinMaxItemSize,
-                                  RelationGetRelationName(idxrel))));
+                       errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
+                                  newsz, BrinMaxItemSize, RelationGetRelationName(idxrel))));
                return false;                   /* keep compiler quiet */
        }
 
@@ -357,10 +355,8 @@ brin_doinsert(Relation idxrel, BlockNumber pagesPerRange,
        {
                ereport(ERROR,
                                (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-                       errmsg("index row size %lu exceeds maximum %lu for index \"%s\"",
-                                  (unsigned long) itemsz,
-                                  (unsigned long) BrinMaxItemSize,
-                                  RelationGetRelationName(idxrel))));
+                       errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
+                                  itemsz, BrinMaxItemSize, RelationGetRelationName(idxrel))));
                return InvalidOffsetNumber;             /* keep compiler quiet */
        }
 
@@ -669,7 +665,7 @@ brin_getinsertbuffer(Relation irel, Buffer oldbuf, Size itemsz,
        BlockNumber oldblk;
        BlockNumber newblk;
        Page            page;
-       int                     freespace;
+       Size            freespace;
 
        /* callers must have checked */
        Assert(itemsz <= BrinMaxItemSize);
@@ -825,10 +821,8 @@ brin_getinsertbuffer(Relation irel, Buffer oldbuf, Size itemsz,
 
                        ereport(ERROR,
                                        (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
-                       errmsg("index row size %lu exceeds maximum %lu for index \"%s\"",
-                                  (unsigned long) itemsz,
-                                  (unsigned long) freespace,
-                                  RelationGetRelationName(irel))));
+                       errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
+                                  itemsz, freespace, RelationGetRelationName(irel))));
                        return InvalidBuffer;           /* keep compiler quiet */
                }
 
index 2328b92b4ea21f5adb88ab32b5c13dd960e1c81a..dde8dd3401b0fdae58e4c8ea63064b6602452c71 100644 (file)
@@ -3462,7 +3462,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
                ereport(INFO,
                                (errmsg("index \"%s\" was reindexed",
                                                get_rel_name(indexId)),
-                                errdetail("%s.",
+                                errdetail_internal("%s",
                                                   pg_rusage_show(&ru0))));
 
        /* Close rels, but keep locks */
index 2a33eb73fa9b276f67bf21d74183f85b930dadf0..94755d687b74637ce8ea7b910b63dd4dc4cd82a4 100644 (file)
@@ -3793,7 +3793,7 @@ InitTempTableNamespace(void)
        if (IsParallelWorker())
                ereport(ERROR,
                                (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
-                                errmsg("cannot create temporary tables in parallel mode")));
+                                errmsg("cannot create temporary tables during a parallel operation")));
 
        snprintf(namespaceName, sizeof(namespaceName), "pg_temp_%d", MyBackendId);
 
index 56356de670d83d9cda2bf741a64dee66a74ada5c..09e53ff004e16631999759e0d71b99fe2f6a7105 100644 (file)
@@ -1353,8 +1353,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats,
                                                                        "%u pages are entirely empty.\n",
                                                                        empty_pages),
                                         empty_pages);
-       appendStringInfo(&buf, _("%s."),
-                                        pg_rusage_show(&ru0));
+       appendStringInfo(&buf, "%s.", pg_rusage_show(&ru0));
 
        ereport(elevel,
                        (errmsg("\"%s\": found %.0f removable, %.0f nonremovable row versions in %u out of %u pages",
@@ -1429,8 +1428,7 @@ lazy_vacuum_heap(Relation onerel, LVRelStats *vacrelstats)
                        (errmsg("\"%s\": removed %d row versions in %d pages",
                                        RelationGetRelationName(onerel),
                                        tupindex, npages),
-                        errdetail("%s.",
-                                          pg_rusage_show(&ru0))));
+                        errdetail_internal("%s", pg_rusage_show(&ru0))));
 }
 
 /*
@@ -1618,7 +1616,7 @@ lazy_vacuum_index(Relation indrel,
                        (errmsg("scanned index \"%s\" to remove %d row versions",
                                        RelationGetRelationName(indrel),
                                        vacrelstats->num_dead_tuples),
-                        errdetail("%s.", pg_rusage_show(&ru0))));
+                        errdetail_internal("%s", pg_rusage_show(&ru0))));
 }
 
 /*
@@ -1828,7 +1826,7 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats)
                                (errmsg("\"%s\": truncated %u to %u pages",
                                                RelationGetRelationName(onerel),
                                                old_rel_pages, new_rel_pages),
-                                errdetail("%s.",
+                                errdetail_internal("%s",
                                                   pg_rusage_show(&ru0))));
                old_rel_pages = new_rel_pages;
        } while (new_rel_pages > vacrelstats->nonempty_pages &&
index d75bddd87b26cad79ece963350cc2738e190d964..204ad3c978ff43da4a99861885c37257c220e9e4 100644 (file)
@@ -773,7 +773,7 @@ assign_client_encoding(const char *newval, void *extra)
                 */
                ereport(ERROR,
                                (errcode(ERRCODE_INVALID_TRANSACTION_STATE),
-                         errmsg("cannot change client_encoding in a parallel worker")));
+                         errmsg("cannot change client_encoding during a parallel operation")));
        }
 
        /* We do not expect an error if PrepareClientEncoding succeeded */
index fdf045a45b0409c4c8f46c3b2f9e73a525dfc4b8..c6505140bd3e0ba3d09ae6e5c8ca2bf850731b2c 100644 (file)
@@ -902,7 +902,7 @@ PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems)
                        offset != MAXALIGN(offset))
                        ereport(ERROR,
                                        (errcode(ERRCODE_DATA_CORRUPTED),
-                                        errmsg("corrupted item pointer: offset = %u, size = %u",
+                                        errmsg("corrupted item pointer: offset = %u, length = %u",
                                                        offset, (unsigned int) size)));
 
                if (nextitm < nitems && offnum == itemnos[nextitm])
index 47371ab7cb0f042167b02474ebdcc21f1ab2dbc2..3e2dd6c0eca4c8c3686386961558500f4340484d 100644 (file)
@@ -2008,7 +2008,7 @@ json_object_agg_transfn(PG_FUNCTION_ARGS)
                if (arg_type == InvalidOid)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                                        errmsg("could not determine data type for argument 1")));
+                                        errmsg("could not determine data type for argument %d", 1)));
 
                json_categorize_type(arg_type, &state->key_category,
                                                         &state->key_output_func);
@@ -2018,7 +2018,7 @@ json_object_agg_transfn(PG_FUNCTION_ARGS)
                if (arg_type == InvalidOid)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                                        errmsg("could not determine data type for argument 2")));
+                                        errmsg("could not determine data type for argument %d", 2)));
 
                json_categorize_type(arg_type, &state->val_category,
                                                         &state->val_output_func);
index 952040d5bb116fc0bba71e07332bcd002f5e623e..2b36ea39eb1f0b6d5bd7b40befa4ff0547b46d57 100644 (file)
@@ -1212,7 +1212,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
                if (val_type == InvalidOid || val_type == UNKNOWNOID)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                          errmsg("argument %d: could not determine data type", i + 1)));
+                          errmsg("could not determine data type for argument %d", i + 1)));
 
                add_jsonb(arg, false, &result, val_type, true);
 
@@ -1235,7 +1235,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
                if (val_type == InvalidOid || val_type == UNKNOWNOID)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                          errmsg("argument %d: could not determine data type", i + 2)));
+                          errmsg("could not determine data type for argument %d", i + 2)));
                add_jsonb(arg, PG_ARGISNULL(i + 1), &result, val_type, false);
        }
 
@@ -1295,7 +1295,7 @@ jsonb_build_array(PG_FUNCTION_ARGS)
                if (val_type == InvalidOid || val_type == UNKNOWNOID)
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                          errmsg("argument %d: could not determine data type", i + 1)));
+                          errmsg("could not determine data type for argument %d", i + 1)));
                add_jsonb(arg, PG_ARGISNULL(i), &result, val_type, false);
        }
 
index e4dccc383a5b6aacb2030a139b20133bc5d642e8..98fa7ea9a8a12f57ed27aeaf4726c69fa575a890 100644 (file)
@@ -61,7 +61,7 @@ pg_rusage_show(const PGRUsage *ru0)
        }
 
        snprintf(result, sizeof(result),
-                        "CPU: user: %d.%02d s, system: %d.%02d s, elapsed: %d.%02d s",
+                        _("CPU: user: %d.%02d s, system: %d.%02d s, elapsed: %d.%02d s"),
                         (int) (ru1.ru.ru_utime.tv_sec - ru0->ru.ru_utime.tv_sec),
                  (int) (ru1.ru.ru_utime.tv_usec - ru0->ru.ru_utime.tv_usec) / 10000,
                         (int) (ru1.ru.ru_stime.tv_sec - ru0->ru.ru_stime.tv_sec),