Skip to content

Commit 072457b

Browse files
committed
Message punctuation and pluralization fixes
1 parent 9d775d8 commit 072457b

File tree

6 files changed

+32
-24
lines changed

6 files changed

+32
-24
lines changed

src/backend/access/transam/multixact.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -940,14 +940,18 @@ GetNewMultiXactId(int nmembers, MultiXactOffset *offset)
940940
/* complain even if that DB has disappeared */
941941
if (oldest_datname)
942942
ereport(WARNING,
943-
(errmsg("database \"%s\" must be vacuumed before %u more MultiXactIds are used",
943+
(errmsg_plural("database \"%s\" must be vacuumed before %u more MultiXactId is used",
944+
"database \"%s\" must be vacuumed before %u more MultiXactIds are used",
945+
multiWrapLimit - result,
944946
oldest_datname,
945947
multiWrapLimit - result),
946948
errhint("Execute a database-wide VACUUM in that database.\n"
947949
"You might also need to commit or roll back old prepared transactions.")));
948950
else
949951
ereport(WARNING,
950-
(errmsg("database with OID %u must be vacuumed before %u more MultiXactIds are used",
952+
(errmsg_plural("database with OID %u must be vacuumed before %u more MultiXactId is used",
953+
"database with OID %u must be vacuumed before %u more MultiXactIds are used",
954+
multiWrapLimit - result,
951955
oldest_datoid,
952956
multiWrapLimit - result),
953957
errhint("Execute a database-wide VACUUM in that database.\n"
@@ -1982,14 +1986,18 @@ SetMultiXactIdLimit(MultiXactId oldest_datminmxid, Oid oldest_datoid)
19821986

19831987
if (oldest_datname)
19841988
ereport(WARNING,
1985-
(errmsg("database \"%s\" must be vacuumed before %u more MultiXactIds are used",
1989+
(errmsg_plural("database \"%s\" must be vacuumed before %u more MultiXactId is used",
1990+
"database \"%s\" must be vacuumed before %u more MultiXactIds are used",
1991+
multiWrapLimit - curMulti,
19861992
oldest_datname,
19871993
multiWrapLimit - curMulti),
19881994
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"
19891995
"You might also need to commit or roll back old prepared transactions.")));
19901996
else
19911997
ereport(WARNING,
1992-
(errmsg("database with OID %u must be vacuumed before %u more MultiXactIds are used",
1998+
(errmsg_plural("database with OID %u must be vacuumed before %u more MultiXactId is used",
1999+
"database with OID %u must be vacuumed before %u more MultiXactIds are used",
2000+
multiWrapLimit - curMulti,
19932001
oldest_datoid,
19942002
multiWrapLimit - curMulti),
19952003
errhint("To avoid a database shutdown, execute a database-wide VACUUM in that database.\n"

src/backend/access/transam/xlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6138,7 +6138,7 @@ StartupXLOG(void)
61386138
ereport(ERROR,
61396139
(errcode(ERRCODE_OUT_OF_MEMORY),
61406140
errmsg("out of memory"),
6141-
errdetail("Failed while allocating an XLog reading processor")));
6141+
errdetail("Failed while allocating an XLog reading processor.")));
61426142
xlogreader->system_identifier = ControlFile->system_identifier;
61436143

61446144
if (read_backup_label(&checkPointLoc, &backupEndRequired,

src/backend/utils/adt/json.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ json_lex_string(JsonLexContext *lex)
728728
ereport(ERROR,
729729
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
730730
errmsg("invalid input syntax for type json"),
731-
errdetail("high order surrogate must not follow a high order surrogate."),
731+
errdetail("Unicode high surrogate must not follow a high surrogate."),
732732
report_json_context(lex)));
733733
hi_surrogate = (ch & 0x3ff) << 10;
734734
continue;
@@ -739,7 +739,7 @@ json_lex_string(JsonLexContext *lex)
739739
ereport(ERROR,
740740
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
741741
errmsg("invalid input syntax for type json"),
742-
errdetail("low order surrogate must follow a high order surrogate."),
742+
errdetail("Unicode low surrogate must follow a high surrogate."),
743743
report_json_context(lex)));
744744
ch = 0x10000 + hi_surrogate + (ch & 0x3ff);
745745
hi_surrogate = -1;
@@ -749,7 +749,7 @@ json_lex_string(JsonLexContext *lex)
749749
ereport(ERROR,
750750
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
751751
errmsg("invalid input syntax for type json"),
752-
errdetail("low order surrogate must follow a high order surrogate."),
752+
errdetail("Unicode low surrogate must follow a high surrogate."),
753753
report_json_context(lex)));
754754

755755
/*
@@ -783,7 +783,7 @@ json_lex_string(JsonLexContext *lex)
783783
ereport(ERROR,
784784
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
785785
errmsg("invalid input syntax for type json"),
786-
errdetail("Unicode escape for code points higher than U+007F not permitted in non-UTF8 encoding"),
786+
errdetail("Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8."),
787787
report_json_context(lex)));
788788
}
789789

@@ -795,7 +795,7 @@ json_lex_string(JsonLexContext *lex)
795795
ereport(ERROR,
796796
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
797797
errmsg("invalid input syntax for type json"),
798-
errdetail("low order surrogate must follow a high order surrogate."),
798+
errdetail("Unicode low surrogate must follow a high surrogate."),
799799
report_json_context(lex)));
800800

801801
switch (*s)
@@ -856,7 +856,7 @@ json_lex_string(JsonLexContext *lex)
856856
ereport(ERROR,
857857
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
858858
errmsg("invalid input syntax for type json"),
859-
errdetail("low order surrogate must follow a high order surrogate."),
859+
errdetail("Unicode low surrogate must follow a high surrogate."),
860860
report_json_context(lex)));
861861

862862
appendStringInfoChar(lex->strval, *s);
@@ -868,7 +868,7 @@ json_lex_string(JsonLexContext *lex)
868868
ereport(ERROR,
869869
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
870870
errmsg("invalid input syntax for type json"),
871-
errdetail("low order surrogate must follow a high order surrogate."),
871+
errdetail("Unicode low surrogate must follow a high surrogate."),
872872
report_json_context(lex)));
873873

874874
/* Hooray, we found the end of the string! */

src/backend/utils/adt/jsonfuncs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,7 +1239,7 @@ json_populate_record(PG_FUNCTION_ARGS)
12391239
if (!type_is_rowtype(argtype))
12401240
ereport(ERROR,
12411241
(errcode(ERRCODE_DATATYPE_MISMATCH),
1242-
errmsg("first argument must be a rowtype")));
1242+
errmsg("first argument of json_populate_record must be a row type")));
12431243

12441244
if (PG_ARGISNULL(0))
12451245
{
@@ -1581,7 +1581,7 @@ json_populate_recordset(PG_FUNCTION_ARGS)
15811581
if (!type_is_rowtype(argtype))
15821582
ereport(ERROR,
15831583
(errcode(ERRCODE_DATATYPE_MISMATCH),
1584-
errmsg("first argument must be a rowtype")));
1584+
errmsg("first argument of json_populate_recordset must be a row type")));
15851585

15861586
rsi = (ReturnSetInfo *) fcinfo->resultinfo;
15871587

src/test/regress/expected/json.out

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -929,19 +929,19 @@ select json '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a' as correct_in_utf8;
929929

930930
select json '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row
931931
ERROR: invalid input syntax for type json
932-
DETAIL: high order surrogate must not follow a high order surrogate.
932+
DETAIL: Unicode high surrogate must not follow a high surrogate.
933933
CONTEXT: JSON data, line 1: { "a":...
934934
select json '{ "a": "\ude04\ud83d" }' -> 'a'; -- surrogates in wrong order
935935
ERROR: invalid input syntax for type json
936-
DETAIL: low order surrogate must follow a high order surrogate.
936+
DETAIL: Unicode low surrogate must follow a high surrogate.
937937
CONTEXT: JSON data, line 1: { "a":...
938938
select json '{ "a": "\ud83dX" }' -> 'a'; -- orphan high surrogate
939939
ERROR: invalid input syntax for type json
940-
DETAIL: low order surrogate must follow a high order surrogate.
940+
DETAIL: Unicode low surrogate must follow a high surrogate.
941941
CONTEXT: JSON data, line 1: { "a":...
942942
select json '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate
943943
ERROR: invalid input syntax for type json
944-
DETAIL: low order surrogate must follow a high order surrogate.
944+
DETAIL: Unicode low surrogate must follow a high surrogate.
945945
CONTEXT: JSON data, line 1: { "a":...
946946
--handling of simple unicode escapes
947947
select json '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8;

src/test/regress/expected/json_1.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -923,28 +923,28 @@ ERROR: cannot call json_populate_recordset on a nested object
923923
-- handling of unicode surrogate pairs
924924
select json '{ "a": "\ud83d\ude04\ud83d\udc36" }' -> 'a' as correct_in_utf8;
925925
ERROR: invalid input syntax for type json
926-
DETAIL: Unicode escape for code points higher than U+007F not permitted in non-UTF8 encoding
926+
DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
927927
CONTEXT: JSON data, line 1: { "a":...
928928
select json '{ "a": "\ud83d\ud83d" }' -> 'a'; -- 2 high surrogates in a row
929929
ERROR: invalid input syntax for type json
930-
DETAIL: high order surrogate must not follow a high order surrogate.
930+
DETAIL: Unicode high surrogate must not follow a high surrogate.
931931
CONTEXT: JSON data, line 1: { "a":...
932932
select json '{ "a": "\ude04\ud83d" }' -> 'a'; -- surrogates in wrong order
933933
ERROR: invalid input syntax for type json
934-
DETAIL: low order surrogate must follow a high order surrogate.
934+
DETAIL: Unicode low surrogate must follow a high surrogate.
935935
CONTEXT: JSON data, line 1: { "a":...
936936
select json '{ "a": "\ud83dX" }' -> 'a'; -- orphan high surrogate
937937
ERROR: invalid input syntax for type json
938-
DETAIL: low order surrogate must follow a high order surrogate.
938+
DETAIL: Unicode low surrogate must follow a high surrogate.
939939
CONTEXT: JSON data, line 1: { "a":...
940940
select json '{ "a": "\ude04X" }' -> 'a'; -- orphan low surrogate
941941
ERROR: invalid input syntax for type json
942-
DETAIL: low order surrogate must follow a high order surrogate.
942+
DETAIL: Unicode low surrogate must follow a high surrogate.
943943
CONTEXT: JSON data, line 1: { "a":...
944944
--handling of simple unicode escapes
945945
select json '{ "a": "the Copyright \u00a9 sign" }' ->> 'a' as correct_in_utf8;
946946
ERROR: invalid input syntax for type json
947-
DETAIL: Unicode escape for code points higher than U+007F not permitted in non-UTF8 encoding
947+
DETAIL: Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8.
948948
CONTEXT: JSON data, line 1: { "a":...
949949
select json '{ "a": "dollar \u0024 character" }' ->> 'a' as correct_everywhere;
950950
correct_everywhere

0 commit comments

Comments
 (0)