Skip to content

Commit 689cabf

Browse files
committed
Message improvements
1 parent 75c8af9 commit 689cabf

File tree

26 files changed

+76
-80
lines changed

26 files changed

+76
-80
lines changed

src/backend/access/transam/parallel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,12 +842,12 @@ ParallelWorkerMain(Datum main_arg)
842842
if (seg == NULL)
843843
ereport(ERROR,
844844
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
845-
errmsg("unable to map dynamic shared memory segment")));
845+
errmsg("could not map dynamic shared memory segment")));
846846
toc = shm_toc_attach(PARALLEL_MAGIC, dsm_segment_address(seg));
847847
if (toc == NULL)
848848
ereport(ERROR,
849849
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
850-
errmsg("bad magic number in dynamic shared memory segment")));
850+
errmsg("invalid magic number in dynamic shared memory segment")));
851851

852852
/* Look up fixed parallel state. */
853853
fps = shm_toc_lookup(toc, PARALLEL_KEY_FIXED);
@@ -998,7 +998,7 @@ ParallelExtensionTrampoline(dsm_segment *seg, shm_toc *toc)
998998
static void
999999
ParallelErrorContext(void *arg)
10001000
{
1001-
errcontext("parallel worker, pid %d", *(int32 *) arg);
1001+
errcontext("parallel worker, PID %d", *(int32 *) arg);
10021002
}
10031003

10041004
/*

src/backend/access/transam/xlog.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4976,9 +4976,10 @@ readRecoveryCommandFile(void)
49764976
else
49774977
ereport(ERROR,
49784978
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
4979-
errmsg("invalid value for recovery parameter \"%s\"",
4980-
"recovery_target_action"),
4981-
errhint("The allowed values are \"pause\", \"promote\", and \"shutdown\".")));
4979+
errmsg("invalid value for recovery parameter \"%s\": \"%s\"",
4980+
"recovery_target_action",
4981+
item->value),
4982+
errhint("Valid values are \"pause\", \"promote\", and \"shutdown\".")));
49824983

49834984
ereport(DEBUG2,
49844985
(errmsg_internal("recovery_target_action = '%s'",
@@ -5058,7 +5059,9 @@ readRecoveryCommandFile(void)
50585059
else
50595060
ereport(ERROR,
50605061
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
5061-
errmsg("invalid value for recovery parameter \"recovery_target\""),
5062+
errmsg("invalid value for recovery parameter \"%s\": \"%s\"",
5063+
"recovery_target",
5064+
item->value),
50625065
errhint("The only allowed value is \"immediate\".")));
50635066
ereport(DEBUG2,
50645067
(errmsg_internal("recovery_target = '%s'",
@@ -6142,15 +6145,15 @@ StartupXLOG(void)
61426145
unlink(TABLESPACE_MAP_OLD);
61436146
if (rename(TABLESPACE_MAP, TABLESPACE_MAP_OLD) == 0)
61446147
ereport(LOG,
6145-
(errmsg("ignoring \"%s\" file because no \"%s\" file exists",
6148+
(errmsg("ignoring file \"%s\" because no file \"%s\" exists",
61466149
TABLESPACE_MAP, BACKUP_LABEL_FILE),
61476150
errdetail("File \"%s\" was renamed to \"%s\".",
61486151
TABLESPACE_MAP, TABLESPACE_MAP_OLD)));
61496152
else
61506153
ereport(LOG,
61516154
(errmsg("ignoring \"%s\" file because no \"%s\" file exists",
61526155
TABLESPACE_MAP, BACKUP_LABEL_FILE),
6153-
errdetail("File \"%s\" could not be renamed to \"%s\": %m.",
6156+
errdetail("Could not rename file \"%s\" to \"%s\": %m.",
61546157
TABLESPACE_MAP, TABLESPACE_MAP_OLD)));
61556158
}
61566159

@@ -6281,24 +6284,24 @@ StartupXLOG(void)
62816284
LastRec = RecPtr = checkPointLoc;
62826285

62836286
ereport(DEBUG1,
6284-
(errmsg("redo record is at %X/%X; shutdown %s",
6287+
(errmsg_internal("redo record is at %X/%X; shutdown %s",
62856288
(uint32) (checkPoint.redo >> 32), (uint32) checkPoint.redo,
62866289
wasShutdown ? "TRUE" : "FALSE")));
62876290
ereport(DEBUG1,
6288-
(errmsg("next transaction ID: %u/%u; next OID: %u",
6291+
(errmsg_internal("next transaction ID: %u/%u; next OID: %u",
62896292
checkPoint.nextXidEpoch, checkPoint.nextXid,
62906293
checkPoint.nextOid)));
62916294
ereport(DEBUG1,
6292-
(errmsg("next MultiXactId: %u; next MultiXactOffset: %u",
6295+
(errmsg_internal("next MultiXactId: %u; next MultiXactOffset: %u",
62936296
checkPoint.nextMulti, checkPoint.nextMultiOffset)));
62946297
ereport(DEBUG1,
6295-
(errmsg("oldest unfrozen transaction ID: %u, in database %u",
6298+
(errmsg_internal("oldest unfrozen transaction ID: %u, in database %u",
62966299
checkPoint.oldestXid, checkPoint.oldestXidDB)));
62976300
ereport(DEBUG1,
6298-
(errmsg("oldest MultiXactId: %u, in database %u",
6301+
(errmsg_internal("oldest MultiXactId: %u, in database %u",
62996302
checkPoint.oldestMulti, checkPoint.oldestMultiDB)));
63006303
ereport(DEBUG1,
6301-
(errmsg("commit timestamp Xid oldest/newest: %u/%u",
6304+
(errmsg_internal("commit timestamp Xid oldest/newest: %u/%u",
63026305
checkPoint.oldestCommitTs,
63036306
checkPoint.newestCommitTs)));
63046307
if (!TransactionIdIsNormal(checkPoint.nextXid))

src/backend/catalog/objectaddress.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,7 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok)
16521652
if (!missing_ok)
16531653
ereport(ERROR,
16541654
(errcode(ERRCODE_UNDEFINED_OBJECT),
1655-
errmsg("user mapping for user \"%s\" in server \"%s\" does not exist",
1655+
errmsg("user mapping for user \"%s\" on server \"%s\" does not exist",
16561656
username, servername)));
16571657
return address;
16581658
}
@@ -1678,7 +1678,7 @@ get_object_address_usermapping(List *objname, List *objargs, bool missing_ok)
16781678
if (!missing_ok)
16791679
ereport(ERROR,
16801680
(errcode(ERRCODE_UNDEFINED_OBJECT),
1681-
errmsg("user mapping for user \"%s\" in server \"%s\" does not exist",
1681+
errmsg("user mapping for user \"%s\" on server \"%s\" does not exist",
16821682
username, servername)));
16831683
return address;
16841684
}

src/backend/commands/copy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
877877
if (is_from)
878878
ereport(ERROR,
879879
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
880-
errmsg("COPY FROM not supported with row level security."),
880+
errmsg("COPY FROM not supported with row-level security."),
881881
errhint("Use INSERT statements instead.")));
882882

883883
/* Build target list */

src/backend/commands/extension.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3028,7 +3028,7 @@ read_whole_file(const char *filename, int *length)
30283028
if (fst.st_size > (MaxAllocSize - 1))
30293029
ereport(ERROR,
30303030
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
3031-
errmsg("file too large")));
3031+
errmsg("file \"%s\" is too large", filename)));
30323032
bytes_to_read = (size_t) fst.st_size;
30333033

30343034
if ((file = AllocateFile(filename, PG_BINARY_R)) == NULL)

src/backend/commands/tablecmds.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11195,10 +11195,8 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
1119511195
case RELPERSISTENCE_TEMP:
1119611196
ereport(ERROR,
1119711197
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
11198-
errmsg("cannot change logged status of table %s",
11198+
errmsg("cannot change logged status of table \"%s\" because it is temporary",
1119911199
RelationGetRelationName(rel)),
11200-
errdetail("Table %s is temporary.",
11201-
RelationGetRelationName(rel)),
1120211200
errtable(rel)));
1120311201
break;
1120411202
case RELPERSISTENCE_PERMANENT:
@@ -11256,23 +11254,19 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
1125611254
if (foreignrel->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT)
1125711255
ereport(ERROR,
1125811256
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
11259-
errmsg("cannot change status of table %s to logged",
11260-
RelationGetRelationName(rel)),
11261-
errdetail("Table %s references unlogged table %s.",
11262-
RelationGetRelationName(rel),
11263-
RelationGetRelationName(foreignrel)),
11257+
errmsg("could not change table \"%s\" to logged because it references unlogged table \"%s\"",
11258+
RelationGetRelationName(rel),
11259+
RelationGetRelationName(foreignrel)),
1126411260
errtableconstraint(rel, NameStr(con->conname))));
1126511261
}
1126611262
else
1126711263
{
1126811264
if (foreignrel->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
1126911265
ereport(ERROR,
1127011266
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
11271-
errmsg("cannot change status of table %s to unlogged",
11272-
RelationGetRelationName(rel)),
11273-
errdetail("Logged table %s is referenced by table %s.",
11274-
RelationGetRelationName(foreignrel),
11275-
RelationGetRelationName(rel)),
11267+
errmsg("could not change table \"%s\" to unlogged because it references logged table \"%s\"",
11268+
RelationGetRelationName(rel),
11269+
RelationGetRelationName(foreignrel)),
1127611270
errtableconstraint(rel, NameStr(con->conname))));
1127711271
}
1127811272

src/backend/commands/tablespace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ destroy_tablespace_directories(Oid tablespaceoid, bool redo)
800800
/* Refuse to remove anything that's not a directory or symlink */
801801
ereport(redo ? LOG : ERROR,
802802
(ERRCODE_SYSTEM_ERROR,
803-
errmsg("not a directory or symbolic link: \"%s\"",
803+
errmsg("\"%s\" is not a directory or symbolic link",
804804
linkloc)));
805805
}
806806

@@ -886,7 +886,7 @@ remove_tablespace_symlink(const char *linkloc)
886886
{
887887
/* Refuse to remove anything that's not a directory or symlink */
888888
ereport(ERROR,
889-
(errmsg("not a directory or symbolic link: \"%s\"",
889+
(errmsg("\"%s\" is not a directory or symbolic link",
890890
linkloc)));
891891
}
892892
}

src/backend/libpq/auth.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,7 @@ recv_password_packet(Port *port)
668668
errmsg("invalid password packet size")));
669669

670670
/* Do not echo password to logs, for security. */
671-
ereport(DEBUG5,
672-
(errmsg("received password packet")));
671+
elog(DEBUG5, "received password packet");
673672

674673
/*
675674
* Return the received string. Note we do not attempt to do any

src/backend/libpq/pqcomm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,7 @@ pq_startmsgread(void)
11361136
if (PqCommReadingMsg)
11371137
ereport(FATAL,
11381138
(errcode(ERRCODE_PROTOCOL_VIOLATION),
1139-
errmsg("terminating connection because protocol sync was lost")));
1139+
errmsg("terminating connection because protocol synchronization was lost")));
11401140

11411141
PqCommReadingMsg = true;
11421142
}

src/backend/parser/parse_agg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
979979
if (!gsets)
980980
ereport(ERROR,
981981
(errcode(ERRCODE_STATEMENT_TOO_COMPLEX),
982-
errmsg("too many grouping sets present (max 4096)"),
982+
errmsg("too many grouping sets present (maximum 4096)"),
983983
parser_errposition(pstate,
984984
qry->groupClause
985985
? exprLocation((Node *) qry->groupClause)

src/backend/parser/parse_clause.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2856,7 +2856,7 @@ transformOnConflictArbiter(ParseState *pstate,
28562856
ereport(ERROR,
28572857
(errcode(ERRCODE_SYNTAX_ERROR),
28582858
errmsg("ON CONFLICT DO UPDATE requires inference specification or constraint name"),
2859-
errhint("For example, ON CONFLICT (<column>)."),
2859+
errhint("For example, ON CONFLICT (column_name)."),
28602860
parser_errposition(pstate,
28612861
exprLocation((Node *) onConflictClause))));
28622862

src/backend/parser/parse_relation.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3080,7 +3080,7 @@ errorMissingColumn(ParseState *pstate,
30803080
errmsg("column %s.%s does not exist", relname, colname) :
30813081
errmsg("column \"%s\" does not exist", colname),
30823082
state->rfirst ? closestfirst ?
3083-
errhint("Perhaps you meant to reference the column \"%s\".\"%s\".",
3083+
errhint("Perhaps you meant to reference the column \"%s.%s\".",
30843084
state->rfirst->eref->aliasname, closestfirst) :
30853085
errhint("There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
30863086
colname, state->rfirst->eref->aliasname) : 0,
@@ -3099,7 +3099,7 @@ errorMissingColumn(ParseState *pstate,
30993099
relname ?
31003100
errmsg("column %s.%s does not exist", relname, colname) :
31013101
errmsg("column \"%s\" does not exist", colname),
3102-
errhint("Perhaps you meant to reference the column \"%s\".\"%s\" or the column \"%s\".\"%s\".",
3102+
errhint("Perhaps you meant to reference the column \"%s.%s\" or the column \"%s.%s\".",
31033103
state->rfirst->eref->aliasname, closestfirst,
31043104
state->rsecond->eref->aliasname, closestsecond),
31053105
parser_errposition(pstate, location)));

src/backend/postmaster/postmaster.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2047,8 +2047,10 @@ ProcessStartupPacket(Port *port, bool SSLdone)
20472047
else if (!parse_bool(valptr, &am_walsender))
20482048
ereport(FATAL,
20492049
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2050-
errmsg("invalid value for parameter \"replication\""),
2051-
errhint("Valid values are: false, 0, true, 1, database.")));
2050+
errmsg("invalid value for parameter \"%s\": \"%s\"",
2051+
"replication",
2052+
valptr),
2053+
errhint("Valid values are: \"false\", 0, \"true\", 1, \"database\".")));
20522054
}
20532055
else
20542056
{

src/backend/storage/lmgr/lwlock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ PRINT_LWDEBUG(const char *where, LWLock *lock, LWLockMode mode)
187187
ereport(LOG,
188188
(errhidestmt(true),
189189
errhidecontext(true),
190-
errmsg("%d: %s(%s %d): excl %u shared %u haswaiters %u waiters %u rOK %d",
190+
errmsg_internal("%d: %s(%s %d): excl %u shared %u haswaiters %u waiters %u rOK %d",
191191
MyProcPid,
192192
where, T_NAME(lock), T_ID(lock),
193193
!!(state & LW_VAL_EXCLUSIVE),
@@ -207,7 +207,7 @@ LOG_LWDEBUG(const char *where, LWLock *lock, const char *msg)
207207
ereport(LOG,
208208
(errhidestmt(true),
209209
errhidecontext(true),
210-
errmsg("%s(%s %d): %s", where,
210+
errmsg_internal("%s(%s %d): %s", where,
211211
T_NAME(lock), T_ID(lock), msg)));
212212
}
213213
}

src/backend/utils/adt/array_userfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ array_position_common(FunctionCallInfo fcinfo)
746746
if (PG_ARGISNULL(2))
747747
ereport(ERROR,
748748
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
749-
errmsg("initial position should not be NULL")));
749+
errmsg("initial position must not be null")));
750750

751751
position_min = PG_GETARG_INT32(2);
752752
}

src/backend/utils/adt/encode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ b64_decode(const char *src, unsigned len, char *dst)
304304
if (b < 0)
305305
ereport(ERROR,
306306
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
307-
errmsg("invalid symbol '%c' while decoding base64 sequence", (int) c)));
307+
errmsg("invalid symbol \"%c\" while decoding base64 sequence", (int) c)));
308308
}
309309
/* add it to buffer */
310310
buf = (buf << 6) + b;
@@ -325,7 +325,7 @@ b64_decode(const char *src, unsigned len, char *dst)
325325
ereport(ERROR,
326326
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
327327
errmsg("invalid base64 end sequence"),
328-
errhint("Input data is missing padding, truncated, or otherwise corrupted.")));
328+
errhint("Input data is missing padding, is truncated, or is otherwise corrupted.")));
329329

330330
return p - dst;
331331
}

src/backend/utils/adt/jsonb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
11791179
if (nargs % 2 != 0)
11801180
ereport(ERROR,
11811181
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1182-
errmsg("invalid number or arguments: object must be matched key value pairs")));
1182+
errmsg("invalid number of arguments: object must be matched key value pairs")));
11831183

11841184
memset(&result, 0, sizeof(JsonbInState));
11851185

@@ -1193,7 +1193,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
11931193
if (PG_ARGISNULL(i))
11941194
ereport(ERROR,
11951195
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1196-
errmsg("arg %d: key cannot be null", i + 1)));
1196+
errmsg("argument %d: key must not be null", i + 1)));
11971197
val_type = get_fn_expr_argtype(fcinfo->flinfo, i);
11981198

11991199
/*
@@ -1215,7 +1215,7 @@ jsonb_build_object(PG_FUNCTION_ARGS)
12151215
if (val_type == InvalidOid || val_type == UNKNOWNOID)
12161216
ereport(ERROR,
12171217
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1218-
errmsg("arg %d: could not determine data type", i + 1)));
1218+
errmsg("argument %d: could not determine data type", i + 1)));
12191219

12201220
add_jsonb(arg, false, &result, val_type, true);
12211221

src/backend/utils/misc/guc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2462,7 +2462,7 @@ static struct config_int ConfigureNamesInt[] =
24622462

24632463
{
24642464
{"wal_retrieve_retry_interval", PGC_SIGHUP, REPLICATION_STANDBY,
2465-
gettext_noop("Sets the time to wait before retrying to retrieve WAL"
2465+
gettext_noop("Sets the time to wait before retrying to retrieve WAL "
24662466
"after a failed attempt."),
24672467
NULL,
24682468
GUC_UNIT_MS
@@ -2580,7 +2580,7 @@ static struct config_int ConfigureNamesInt[] =
25802580

25812581
{
25822582
{"ssl_renegotiation_limit", PGC_USERSET, CONN_AUTH_SECURITY,
2583-
gettext_noop("SSL regenotiation is no longer supported; this can only be 0"),
2583+
gettext_noop("SSL regenotiation is no longer supported; this can only be 0."),
25842584
NULL,
25852585
GUC_NO_SHOW_ALL | GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE,
25862586
},
@@ -3388,7 +3388,7 @@ static struct config_string ConfigureNamesString[] =
33883388

33893389
{
33903390
{"cluster_name", PGC_POSTMASTER, PROCESS_TITLE,
3391-
gettext_noop("Sets the name of the cluster which is included in the process title."),
3391+
gettext_noop("Sets the name of the cluster, which is included in the process title."),
33923392
NULL,
33933393
GUC_IS_NAME
33943394
},

src/backend/utils/misc/rls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ check_enable_rls(Oid relid, Oid checkAsUser, bool noError)
122122
if (!row_security && !noError)
123123
ereport(ERROR,
124124
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
125-
errmsg("insufficient privilege to bypass row security.")));
125+
errmsg("insufficient privilege to bypass row-level security")));
126126

127127
/* RLS should be fully enabled for this relation. */
128128
return RLS_ENABLED;

src/port/win32error.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ _dosmaperr(unsigned long e)
186186
(errmsg_internal("mapped win32 error code %lu to %d",
187187
e, doserr)));
188188
#elif FRONTEND_DEBUG
189-
fprintf(stderr, _("mapped win32 error code %lu to %d"), e, doserr);
189+
fprintf(stderr, "mapped win32 error code %lu to %d", e, doserr);
190190
#endif
191191
errno = doserr;
192192
return;
@@ -198,7 +198,7 @@ _dosmaperr(unsigned long e)
198198
(errmsg_internal("unrecognized win32 error code: %lu",
199199
e)));
200200
#else
201-
fprintf(stderr, _("unrecognized win32 error code: %lu"), e);
201+
fprintf(stderr, "unrecognized win32 error code: %lu", e);
202202
#endif
203203

204204
errno = EINVAL;

0 commit comments

Comments
 (0)