]> 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/catalog/pg_aggregate.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 4878f8b7768c1e1f60b7c701fdc0b4c3a5a468ec..987e6005cb37995f669fc17f7e19bf068e6a2802 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 b0b43cf02d8d3281c716f874f9ed1181aa1ba481..6aae1ab6fdab0df9029dadcd73532f1dea7e021a 100644 (file)
@@ -3453,7 +3453,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 8fd4c3136bc44726c4d848e1935be9977a30c6e9..8092381ae5c6b2ae9d303c0ee4c27ffcf932821a 100644 (file)
@@ -3685,7 +3685,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 959d3845df217455815c6c0e4c4f85b06ada486f..ada6e6171b711ee8f461db873bfb85e1f406fb16 100644 (file)
@@ -433,7 +433,7 @@ AggregateCreate(const char *aggName,
                if (aggTransType == INTERNALOID && func_strict(combinefn))
                        ereport(ERROR,
                                        (errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
-                                        errmsg("combine function with \"%s\" transition type must not be declared STRICT",
+                                        errmsg("combine function with transition type %s must not be declared STRICT",
                                                        format_type_be(aggTransType))));
 
        }
index e1e39dfb4ee96ee72628097d0cce6eafbe36cc2c..0506a9340c388d752e07713023c92fa59544dd79 100644 (file)
@@ -1342,8 +1342,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",
@@ -1418,8 +1417,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))));
 }
 
 /*
@@ -1607,7 +1605,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))));
 }
 
 /*
@@ -1817,7 +1815,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 defafa54b2968169abf28df85b33dcd72edf6259..1f72d7bee95327bc84095cd6281a1c8d3072532a 100644 (file)
@@ -776,7 +776,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 f2a07f211165205aae20f1e22c0039fc6adfcc93..11607827d8d8337b37253ad0def87908a4c1cf7c 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 c73044b806da19296da331b60467a5bb0e214086..2b6a8391d8be02b3a9f9df00baefcb5298d90d4b 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 987cfd18625008bcae84c2ce9d5bc3f1758a072f..d560e4edbc22d5891f19a02b304186335d9064ac 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 8781a383c082154cb032545f96e4e46b86b0ab07..c21b9501517c99c468d90aff6474c1fb09220c1d 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),