Skip to content

Commit 5db837d

Browse files
committed
Message improvements
1 parent 53264c7 commit 5db837d

File tree

26 files changed

+78
-82
lines changed

26 files changed

+78
-82
lines changed

src/backend/access/transam/parallel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,12 +907,12 @@ ParallelWorkerMain(Datum main_arg)
907907
if (seg == NULL)
908908
ereport(ERROR,
909909
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
910-
errmsg("unable to map dynamic shared memory segment")));
910+
errmsg("could not map dynamic shared memory segment")));
911911
toc = shm_toc_attach(PARALLEL_MAGIC, dsm_segment_address(seg));
912912
if (toc == NULL)
913913
ereport(ERROR,
914914
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
915-
errmsg("bad magic number in dynamic shared memory segment")));
915+
errmsg("invalid magic number in dynamic shared memory segment")));
916916

917917
/* Look up fixed parallel state. */
918918
fps = shm_toc_lookup(toc, PARALLEL_KEY_FIXED);
@@ -1063,7 +1063,7 @@ ParallelExtensionTrampoline(dsm_segment *seg, shm_toc *toc)
10631063
static void
10641064
ParallelErrorContext(void *arg)
10651065
{
1066-
errcontext("parallel worker, pid %d", *(int32 *) arg);
1066+
errcontext("parallel worker, PID %d", *(int32 *) arg);
10671067
}
10681068

10691069
/*

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
@@ -874,7 +874,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString, uint64 *processed)
874874
if (is_from)
875875
ereport(ERROR,
876876
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
877-
errmsg("COPY FROM not supported with row level security."),
877+
errmsg("COPY FROM not supported with row-level security."),
878878
errhint("Use INSERT statements instead.")));
879879

880880
/* Build target list */

src/backend/commands/extension.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3111,7 +3111,7 @@ read_whole_file(const char *filename, int *length)
31113111
if (fst.st_size > (MaxAllocSize - 1))
31123112
ereport(ERROR,
31133113
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
3114-
errmsg("file too large")));
3114+
errmsg("file \"%s\" is too large", filename)));
31153115
bytes_to_read = (size_t) fst.st_size;
31163116

31173117
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
@@ -11213,10 +11213,8 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
1121311213
case RELPERSISTENCE_TEMP:
1121411214
ereport(ERROR,
1121511215
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
11216-
errmsg("cannot change logged status of table %s",
11216+
errmsg("cannot change logged status of table \"%s\" because it is temporary",
1121711217
RelationGetRelationName(rel)),
11218-
errdetail("Table %s is temporary.",
11219-
RelationGetRelationName(rel)),
1122011218
errtable(rel)));
1122111219
break;
1122211220
case RELPERSISTENCE_PERMANENT:
@@ -11274,23 +11272,19 @@ ATPrepChangePersistence(Relation rel, bool toLogged)
1127411272
if (foreignrel->rd_rel->relpersistence != RELPERSISTENCE_PERMANENT)
1127511273
ereport(ERROR,
1127611274
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
11277-
errmsg("cannot change status of table %s to logged",
11278-
RelationGetRelationName(rel)),
11279-
errdetail("Table %s references unlogged table %s.",
11280-
RelationGetRelationName(rel),
11281-
RelationGetRelationName(foreignrel)),
11275+
errmsg("could not change table \"%s\" to logged because it references unlogged table \"%s\"",
11276+
RelationGetRelationName(rel),
11277+
RelationGetRelationName(foreignrel)),
1128211278
errtableconstraint(rel, NameStr(con->conname))));
1128311279
}
1128411280
else
1128511281
{
1128611282
if (foreignrel->rd_rel->relpersistence == RELPERSISTENCE_PERMANENT)
1128711283
ereport(ERROR,
1128811284
(errcode(ERRCODE_INVALID_TABLE_DEFINITION),
11289-
errmsg("cannot change status of table %s to unlogged",
11290-
RelationGetRelationName(rel)),
11291-
errdetail("Logged table %s is referenced by table %s.",
11292-
RelationGetRelationName(foreignrel),
11293-
RelationGetRelationName(rel)),
11285+
errmsg("could not change table \"%s\" to unlogged because it references logged table \"%s\"",
11286+
RelationGetRelationName(rel),
11287+
RelationGetRelationName(foreignrel)),
1129411288
errtableconstraint(rel, NameStr(con->conname))));
1129511289
}
1129611290

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
@@ -1168,7 +1168,7 @@ pq_startmsgread(void)
11681168
if (PqCommReadingMsg)
11691169
ereport(FATAL,
11701170
(errcode(ERRCODE_PROTOCOL_VIOLATION),
1171-
errmsg("terminating connection because protocol sync was lost")));
1171+
errmsg("terminating connection because protocol synchronization was lost")));
11721172

11731173
PqCommReadingMsg = true;
11741174
}

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy