Skip to content

Commit f05c650

Browse files
committed
Message style improvements
1 parent c59b8ba commit f05c650

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

doc/src/sgml/func.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,7 @@
15231523
<entry><type>text</type></entry>
15241524
<entry>
15251525
Format a string. This function is similar to the C function
1526-
<function>sprintf</>; but only the following conversions
1526+
<function>sprintf</>; but only the following conversion specifications
15271527
are recognized: <literal>%s</literal> interpolates the corresponding
15281528
argument as a string; <literal>%I</literal> escapes its argument as
15291529
an SQL identifier; <literal>%L</literal> escapes its argument as an

src/backend/commands/alter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId,
421421
if (Anum_owner <= 0)
422422
ereport(ERROR,
423423
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
424-
(errmsg("must be superuser to SET SCHEMA of %s",
424+
(errmsg("must be superuser to set schema of %s",
425425
getObjectDescriptionOids(classId, objid)))));
426426

427427
/* Otherwise, must be owner of the existing object */

src/backend/replication/basebackup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
119119
if (readlink(fullpath, linkpath, sizeof(linkpath) - 1) == -1)
120120
{
121121
ereport(WARNING,
122-
(errmsg("unable to read symbolic link %s: %m", fullpath)));
122+
(errmsg("could not read symbolic link \"%s\": %m", fullpath)));
123123
continue;
124124
}
125125

@@ -363,7 +363,7 @@ SendBaseBackup(BaseBackupCmd *cmd)
363363
dir = AllocateDir("pg_tblspc");
364364
if (!dir)
365365
ereport(ERROR,
366-
(errmsg("unable to open directory pg_tblspc: %m")));
366+
(errmsg("could not open directory \"pg_tblspc\": %m")));
367367

368368
perform_base_backup(&opt, dir);
369369

src/backend/replication/walsender.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ ProcessRepliesIfAny(void)
515515
default:
516516
ereport(FATAL,
517517
(errcode(ERRCODE_PROTOCOL_VIOLATION),
518-
errmsg("invalid standby message type %d",
518+
errmsg("invalid standby message type \"%c\"",
519519
firstchar)));
520520
}
521521
}
@@ -566,7 +566,7 @@ ProcessStandbyMessage(void)
566566
default:
567567
ereport(COMMERROR,
568568
(errcode(ERRCODE_PROTOCOL_VIOLATION),
569-
errmsg("unexpected message type %c", msgtype)));
569+
errmsg("unexpected message type \"%c\"", msgtype)));
570570
proc_exit(0);
571571
}
572572
}

src/backend/utils/adt/varlena.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3887,7 +3887,7 @@ text_format(PG_FUNCTION_ARGS)
38873887
if (arg > PG_NARGS() - 1)
38883888
ereport(ERROR,
38893889
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
3890-
errmsg("too few arguments for format conversion")));
3890+
errmsg("too few arguments for format")));
38913891

38923892
/*
38933893
* At this point, we should see the main conversion specifier. Whether
@@ -3908,7 +3908,7 @@ text_format(PG_FUNCTION_ARGS)
39083908
default:
39093909
ereport(ERROR,
39103910
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
3911-
errmsg("unrecognized conversion specifier: %c",
3911+
errmsg("unrecognized conversion specifier \"%c\"",
39123912
*cp)));
39133913
}
39143914
}

src/test/regress/expected/text.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,11 @@ select format('Hello %%%%');
171171

172172
-- should fail
173173
select format('Hello %s %s', 'World');
174-
ERROR: too few arguments for format conversion
174+
ERROR: too few arguments for format
175175
select format('Hello %s');
176-
ERROR: too few arguments for format conversion
176+
ERROR: too few arguments for format
177177
select format('Hello %x', 20);
178-
ERROR: unrecognized conversion specifier: x
178+
ERROR: unrecognized conversion specifier "x"
179179
-- check literal and sql identifiers
180180
select format('INSERT INTO %I VALUES(%L,%L)', 'mytab', 10, 'Hello');
181181
format
@@ -219,15 +219,15 @@ select format('%1$s %12$s', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
219219

220220
-- should fail
221221
select format('%1$s %4$s', 1, 2, 3);
222-
ERROR: too few arguments for format conversion
222+
ERROR: too few arguments for format
223223
select format('%1$s %13$s', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
224-
ERROR: too few arguments for format conversion
224+
ERROR: too few arguments for format
225225
select format('%1s', 1);
226226
ERROR: unterminated conversion specifier
227227
select format('%1$', 1);
228228
ERROR: unterminated conversion specifier
229229
select format('%1$1', 1);
230-
ERROR: unrecognized conversion specifier: 1
230+
ERROR: unrecognized conversion specifier "1"
231231
--checkk mix of positional and ordered placeholders
232232
select format('Hello %s %1$s %s', 'World', 'Hello again');
233233
format

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