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)

0 commit comments

Comments
 (0)