Skip to content

Commit 55cd9a8

Browse files
committed
Assorted translatable string fixes
Mark our rusage reportage string translatable; remove quotes from type names; unify formatting of very similar messages.
1 parent 8a7cd78 commit 55cd9a8

File tree

10 files changed

+24
-30
lines changed

10 files changed

+24
-30
lines changed

src/backend/access/brin/brin_pageops.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ brin_doupdate(Relation idxrel, BlockNumber pagesPerRange,
7373
{
7474
ereport(ERROR,
7575
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
76-
errmsg("index row size %lu exceeds maximum %lu for index \"%s\"",
77-
(unsigned long) newsz,
78-
(unsigned long) BrinMaxItemSize,
79-
RelationGetRelationName(idxrel))));
76+
errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
77+
newsz, BrinMaxItemSize, RelationGetRelationName(idxrel))));
8078
return false; /* keep compiler quiet */
8179
}
8280

@@ -359,10 +357,8 @@ brin_doinsert(Relation idxrel, BlockNumber pagesPerRange,
359357
{
360358
ereport(ERROR,
361359
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
362-
errmsg("index row size %lu exceeds maximum %lu for index \"%s\"",
363-
(unsigned long) itemsz,
364-
(unsigned long) BrinMaxItemSize,
365-
RelationGetRelationName(idxrel))));
360+
errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
361+
itemsz, BrinMaxItemSize, RelationGetRelationName(idxrel))));
366362
return InvalidOffsetNumber; /* keep compiler quiet */
367363
}
368364

@@ -669,7 +665,7 @@ brin_getinsertbuffer(Relation irel, Buffer oldbuf, Size itemsz,
669665
BlockNumber oldblk;
670666
BlockNumber newblk;
671667
Page page;
672-
int freespace;
668+
Size freespace;
673669

674670
/* callers must have checked */
675671
Assert(itemsz <= BrinMaxItemSize);
@@ -825,10 +821,8 @@ brin_getinsertbuffer(Relation irel, Buffer oldbuf, Size itemsz,
825821

826822
ereport(ERROR,
827823
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
828-
errmsg("index row size %lu exceeds maximum %lu for index \"%s\"",
829-
(unsigned long) itemsz,
830-
(unsigned long) freespace,
831-
RelationGetRelationName(irel))));
824+
errmsg("index row size %zu exceeds maximum %zu for index \"%s\"",
825+
itemsz, freespace, RelationGetRelationName(irel))));
832826
return InvalidBuffer; /* keep compiler quiet */
833827
}
834828

src/backend/catalog/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3453,7 +3453,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence,
34533453
ereport(INFO,
34543454
(errmsg("index \"%s\" was reindexed",
34553455
get_rel_name(indexId)),
3456-
errdetail("%s.",
3456+
errdetail_internal("%s",
34573457
pg_rusage_show(&ru0))));
34583458

34593459
/* Close rels, but keep locks */

src/backend/catalog/namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3685,7 +3685,7 @@ InitTempTableNamespace(void)
36853685
if (IsParallelWorker())
36863686
ereport(ERROR,
36873687
(errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION),
3688-
errmsg("cannot create temporary tables in parallel mode")));
3688+
errmsg("cannot create temporary tables during a parallel operation")));
36893689

36903690
snprintf(namespaceName, sizeof(namespaceName), "pg_temp_%d", MyBackendId);
36913691

src/backend/catalog/pg_aggregate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ AggregateCreate(const char *aggName,
433433
if (aggTransType == INTERNALOID && func_strict(combinefn))
434434
ereport(ERROR,
435435
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
436-
errmsg("combine function with \"%s\" transition type must not be declared STRICT",
436+
errmsg("combine function with transition type %s must not be declared STRICT",
437437
format_type_be(aggTransType))));
438438

439439
}

src/backend/commands/vacuumlazy.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,8 +1342,7 @@ lazy_scan_heap(Relation onerel, int options, LVRelStats *vacrelstats,
13421342
"%u pages are entirely empty.\n",
13431343
empty_pages),
13441344
empty_pages);
1345-
appendStringInfo(&buf, _("%s."),
1346-
pg_rusage_show(&ru0));
1345+
appendStringInfo(&buf, "%s.", pg_rusage_show(&ru0));
13471346

13481347
ereport(elevel,
13491348
(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)
14181417
(errmsg("\"%s\": removed %d row versions in %d pages",
14191418
RelationGetRelationName(onerel),
14201419
tupindex, npages),
1421-
errdetail("%s.",
1422-
pg_rusage_show(&ru0))));
1420+
errdetail_internal("%s", pg_rusage_show(&ru0))));
14231421
}
14241422

14251423
/*
@@ -1607,7 +1605,7 @@ lazy_vacuum_index(Relation indrel,
16071605
(errmsg("scanned index \"%s\" to remove %d row versions",
16081606
RelationGetRelationName(indrel),
16091607
vacrelstats->num_dead_tuples),
1610-
errdetail("%s.", pg_rusage_show(&ru0))));
1608+
errdetail_internal("%s", pg_rusage_show(&ru0))));
16111609
}
16121610

16131611
/*
@@ -1817,7 +1815,7 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats)
18171815
(errmsg("\"%s\": truncated %u to %u pages",
18181816
RelationGetRelationName(onerel),
18191817
old_rel_pages, new_rel_pages),
1820-
errdetail("%s.",
1818+
errdetail_internal("%s",
18211819
pg_rusage_show(&ru0))));
18221820
old_rel_pages = new_rel_pages;
18231821
} while (new_rel_pages > vacrelstats->nonempty_pages &&

src/backend/commands/variable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ assign_client_encoding(const char *newval, void *extra)
776776
*/
777777
ereport(ERROR,
778778
(errcode(ERRCODE_INVALID_TRANSACTION_STATE),
779-
errmsg("cannot change client_encoding in a parallel worker")));
779+
errmsg("cannot change client_encoding during a parallel operation")));
780780
}
781781

782782
/* We do not expect an error if PrepareClientEncoding succeeded */

src/backend/storage/page/bufpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ PageIndexMultiDelete(Page page, OffsetNumber *itemnos, int nitems)
889889
offset != MAXALIGN(offset))
890890
ereport(ERROR,
891891
(errcode(ERRCODE_DATA_CORRUPTED),
892-
errmsg("corrupted item pointer: offset = %u, size = %u",
892+
errmsg("corrupted item pointer: offset = %u, length = %u",
893893
offset, (unsigned int) size)));
894894

895895
if (nextitm < nitems && offnum == itemnos[nextitm])

src/backend/utils/adt/json.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2003,7 +2003,7 @@ json_object_agg_transfn(PG_FUNCTION_ARGS)
20032003
if (arg_type == InvalidOid)
20042004
ereport(ERROR,
20052005
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2006-
errmsg("could not determine data type for argument 1")));
2006+
errmsg("could not determine data type for argument %d", 1)));
20072007

20082008
json_categorize_type(arg_type, &state->key_category,
20092009
&state->key_output_func);
@@ -2013,7 +2013,7 @@ json_object_agg_transfn(PG_FUNCTION_ARGS)
20132013
if (arg_type == InvalidOid)
20142014
ereport(ERROR,
20152015
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2016-
errmsg("could not determine data type for argument 2")));
2016+
errmsg("could not determine data type for argument %d", 2)));
20172017

20182018
json_categorize_type(arg_type, &state->val_category,
20192019
&state->val_output_func);

src/backend/utils/adt/jsonb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
12111211
if (val_type == InvalidOid || val_type == UNKNOWNOID)
12121212
ereport(ERROR,
12131213
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1214-
errmsg("argument %d: could not determine data type", i + 1)));
1214+
errmsg("could not determine data type for argument %d", i + 1)));
12151215

12161216
add_jsonb(arg, false, &result, val_type, true);
12171217

@@ -1234,7 +1234,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
12341234
if (val_type == InvalidOid || val_type == UNKNOWNOID)
12351235
ereport(ERROR,
12361236
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1237-
errmsg("argument %d: could not determine data type", i + 2)));
1237+
errmsg("could not determine data type for argument %d", i + 2)));
12381238
add_jsonb(arg, PG_ARGISNULL(i + 1), &result, val_type, false);
12391239
}
12401240

@@ -1294,7 +1294,7 @@ jsonb_build_array(PG_FUNCTION_ARGS)
12941294
if (val_type == InvalidOid || val_type == UNKNOWNOID)
12951295
ereport(ERROR,
12961296
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1297-
errmsg("argument %d: could not determine data type", i + 1)));
1297+
errmsg("could not determine data type for argument %d", i + 1)));
12981298
add_jsonb(arg, PG_ARGISNULL(i), &result, val_type, false);
12991299
}
13001300

src/backend/utils/misc/pg_rusage.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ pg_rusage_show(const PGRUsage *ru0)
6161
}
6262

6363
snprintf(result, sizeof(result),
64-
"CPU %d.%02ds/%d.%02du sec elapsed %d.%02d sec",
64+
/*---
65+
* translator: %d.%02ds is system CPU time, %d.%02du is user CPU time */
66+
_("CPU %d.%02ds/%d.%02du sec elapsed %d.%02d sec"),
6567
(int) (ru1.ru.ru_stime.tv_sec - ru0->ru.ru_stime.tv_sec),
6668
(int) (ru1.ru.ru_stime.tv_usec - ru0->ru.ru_stime.tv_usec) / 10000,
6769
(int) (ru1.ru.ru_utime.tv_sec - ru0->ru.ru_utime.tv_sec),

0 commit comments

Comments
 (0)