Message style improvements
This commit is contained in:
parent
c59b8ba6cd
commit
f05c65090a
@ -1523,7 +1523,7 @@
|
|||||||
<entry><type>text</type></entry>
|
<entry><type>text</type></entry>
|
||||||
<entry>
|
<entry>
|
||||||
Format a string. This function is similar to the C function
|
Format a string. This function is similar to the C function
|
||||||
<function>sprintf</>; but only the following conversions
|
<function>sprintf</>; but only the following conversion specifications
|
||||||
are recognized: <literal>%s</literal> interpolates the corresponding
|
are recognized: <literal>%s</literal> interpolates the corresponding
|
||||||
argument as a string; <literal>%I</literal> escapes its argument as
|
argument as a string; <literal>%I</literal> escapes its argument as
|
||||||
an SQL identifier; <literal>%L</literal> escapes its argument as an
|
an SQL identifier; <literal>%L</literal> escapes its argument as an
|
||||||
|
@ -421,7 +421,7 @@ AlterObjectNamespace(Relation rel, int oidCacheId, int nameCacheId,
|
|||||||
if (Anum_owner <= 0)
|
if (Anum_owner <= 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
|
||||||
(errmsg("must be superuser to SET SCHEMA of %s",
|
(errmsg("must be superuser to set schema of %s",
|
||||||
getObjectDescriptionOids(classId, objid)))));
|
getObjectDescriptionOids(classId, objid)))));
|
||||||
|
|
||||||
/* Otherwise, must be owner of the existing object */
|
/* Otherwise, must be owner of the existing object */
|
||||||
|
@ -119,7 +119,7 @@ perform_base_backup(basebackup_options *opt, DIR *tblspcdir)
|
|||||||
if (readlink(fullpath, linkpath, sizeof(linkpath) - 1) == -1)
|
if (readlink(fullpath, linkpath, sizeof(linkpath) - 1) == -1)
|
||||||
{
|
{
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(errmsg("unable to read symbolic link %s: %m", fullpath)));
|
(errmsg("could not read symbolic link \"%s\": %m", fullpath)));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ SendBaseBackup(BaseBackupCmd *cmd)
|
|||||||
dir = AllocateDir("pg_tblspc");
|
dir = AllocateDir("pg_tblspc");
|
||||||
if (!dir)
|
if (!dir)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errmsg("unable to open directory pg_tblspc: %m")));
|
(errmsg("could not open directory \"pg_tblspc\": %m")));
|
||||||
|
|
||||||
perform_base_backup(&opt, dir);
|
perform_base_backup(&opt, dir);
|
||||||
|
|
||||||
|
@ -515,7 +515,7 @@ ProcessRepliesIfAny(void)
|
|||||||
default:
|
default:
|
||||||
ereport(FATAL,
|
ereport(FATAL,
|
||||||
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
||||||
errmsg("invalid standby message type %d",
|
errmsg("invalid standby message type \"%c\"",
|
||||||
firstchar)));
|
firstchar)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -566,7 +566,7 @@ ProcessStandbyMessage(void)
|
|||||||
default:
|
default:
|
||||||
ereport(COMMERROR,
|
ereport(COMMERROR,
|
||||||
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
(errcode(ERRCODE_PROTOCOL_VIOLATION),
|
||||||
errmsg("unexpected message type %c", msgtype)));
|
errmsg("unexpected message type \"%c\"", msgtype)));
|
||||||
proc_exit(0);
|
proc_exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3887,7 +3887,7 @@ text_format(PG_FUNCTION_ARGS)
|
|||||||
if (arg > PG_NARGS() - 1)
|
if (arg > PG_NARGS() - 1)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
errmsg("too few arguments for format conversion")));
|
errmsg("too few arguments for format")));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* At this point, we should see the main conversion specifier. Whether
|
* At this point, we should see the main conversion specifier. Whether
|
||||||
@ -3908,7 +3908,7 @@ text_format(PG_FUNCTION_ARGS)
|
|||||||
default:
|
default:
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
errmsg("unrecognized conversion specifier: %c",
|
errmsg("unrecognized conversion specifier \"%c\"",
|
||||||
*cp)));
|
*cp)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,11 +171,11 @@ select format('Hello %%%%');
|
|||||||
|
|
||||||
-- should fail
|
-- should fail
|
||||||
select format('Hello %s %s', 'World');
|
select format('Hello %s %s', 'World');
|
||||||
ERROR: too few arguments for format conversion
|
ERROR: too few arguments for format
|
||||||
select format('Hello %s');
|
select format('Hello %s');
|
||||||
ERROR: too few arguments for format conversion
|
ERROR: too few arguments for format
|
||||||
select format('Hello %x', 20);
|
select format('Hello %x', 20);
|
||||||
ERROR: unrecognized conversion specifier: x
|
ERROR: unrecognized conversion specifier "x"
|
||||||
-- check literal and sql identifiers
|
-- check literal and sql identifiers
|
||||||
select format('INSERT INTO %I VALUES(%L,%L)', 'mytab', 10, 'Hello');
|
select format('INSERT INTO %I VALUES(%L,%L)', 'mytab', 10, 'Hello');
|
||||||
format
|
format
|
||||||
@ -219,15 +219,15 @@ select format('%1$s %12$s', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
|
|||||||
|
|
||||||
-- should fail
|
-- should fail
|
||||||
select format('%1$s %4$s', 1, 2, 3);
|
select format('%1$s %4$s', 1, 2, 3);
|
||||||
ERROR: too few arguments for format conversion
|
ERROR: too few arguments for format
|
||||||
select format('%1$s %13$s', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
|
select format('%1$s %13$s', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
|
||||||
ERROR: too few arguments for format conversion
|
ERROR: too few arguments for format
|
||||||
select format('%1s', 1);
|
select format('%1s', 1);
|
||||||
ERROR: unterminated conversion specifier
|
ERROR: unterminated conversion specifier
|
||||||
select format('%1$', 1);
|
select format('%1$', 1);
|
||||||
ERROR: unterminated conversion specifier
|
ERROR: unterminated conversion specifier
|
||||||
select format('%1$1', 1);
|
select format('%1$1', 1);
|
||||||
ERROR: unrecognized conversion specifier: 1
|
ERROR: unrecognized conversion specifier "1"
|
||||||
--checkk mix of positional and ordered placeholders
|
--checkk mix of positional and ordered placeholders
|
||||||
select format('Hello %s %1$s %s', 'World', 'Hello again');
|
select format('Hello %s %1$s %s', 'World', 'Hello again');
|
||||||
format
|
format
|
||||||
|
Loading…
x
Reference in New Issue
Block a user