]> 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/storage/page/bufpage.c
src/backend/utils/adt/json.c
src/backend/utils/adt/jsonb.c
src/backend/utils/misc/pg_rusage.c

index b75ff3f40dc1cc07cb485f51fdfc1d479a3cb7d1..7e692df98fe3f74697817c2f9b398831b461a05c 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 */
        }
 
@@ -359,10 +357,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 e59b163173c611f0605ed8e255debcfec0225f5b..90822d8be6a7caad7002ab154c39dd6c7c025507 100644 (file)
@@ -3386,7 +3386,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 b16af64bb3d9d71221ca17b69b0ce0ccc19c14c5..c009e9c241a07ba994d3944864109d10811b561c 100644 (file)
@@ -3651,7 +3651,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 2654c9ebef4a498c650b661bdfb0b13a65035c0c..0ceccc0f9332b6db403f843bacc46253c9fa135f 100644 (file)
@@ -1139,8 +1139,7 @@ lazy_scan_heap(Relation onerel, 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",
@@ -1215,8 +1214,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))));
 }
 
 /*
@@ -1382,7 +1380,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))));
 }
 
 /*
@@ -1554,7 +1552,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 779bf7c48d6b3ea76044e9971da2789b308320e4..b64e27b82c46ea44053318b30fd8dc2127d44a39 100644 (file)
@@ -889,7 +889,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 350c839775c1295525502d9f81c319a320d7d668..eafca14be4d7af276a8a3dd05b987774233a7cf4 100644 (file)
@@ -2003,7 +2003,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);
@@ -2013,7 +2013,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 14ce57e252d1a1ce2329972f6be7fa638ed5c66b..a39d084ce8f9ec6ab16130fae5d0d94eb7bb7f73 100644 (file)
@@ -1211,7 +1211,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);
 
@@ -1234,7 +1234,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);
        }
 
@@ -1294,7 +1294,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 7455035100521da20c7afa067be7289c75525309..ae85b4945b3889856e62027dafa4b3bc3a587e1e 100644 (file)
@@ -61,7 +61,9 @@ pg_rusage_show(const PGRUsage *ru0)
        }
 
        snprintf(result, sizeof(result),
-                        "CPU %d.%02ds/%d.%02du sec elapsed %d.%02d sec",
+       /*---
+        * translator: %d.%02ds is system CPU time, %d.%02du is user CPU time */
+                        _("CPU %d.%02ds/%d.%02du sec elapsed %d.%02d sec"),
                         (int) (ru1.ru.ru_stime.tv_sec - ru0->ru.ru_stime.tv_sec),
                  (int) (ru1.ru.ru_stime.tv_usec - ru0->ru.ru_stime.tv_usec) / 10000,
                         (int) (ru1.ru.ru_utime.tv_sec - ru0->ru.ru_utime.tv_sec),