mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Add missing errcode() in a few ereport calls.
This will allow to specifying SQLSTATE error code for the errors in the missing places. Reported-by: Sawada Masahiko Author: Sawada Masahiko Backpatch-through: 9.5 Discussion: https://postgr.es/m/CA+fd4k6N8EjNvZpM8nme+y+05mz-SM8Z_BgkixzkA34R+ej0Kw@mail.gmail.com
This commit is contained in:
parent
9a9b87191a
commit
fe27ce1c13
@ -128,7 +128,7 @@ pg_file_write(PG_FUNCTION_ARGS)
|
|||||||
|
|
||||||
if (stat(filename, &fst) >= 0)
|
if (stat(filename, &fst) >= 0)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(ERRCODE_DUPLICATE_FILE,
|
(errcode(ERRCODE_DUPLICATE_FILE),
|
||||||
errmsg("file \"%s\" exists", filename)));
|
errmsg("file \"%s\" exists", filename)));
|
||||||
|
|
||||||
f = AllocateFile(filename, "wb");
|
f = AllocateFile(filename, "wb");
|
||||||
@ -194,7 +194,7 @@ pg_file_rename(PG_FUNCTION_ARGS)
|
|||||||
if (rc >= 0 || errno != ENOENT)
|
if (rc >= 0 || errno != ENOENT)
|
||||||
{
|
{
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(ERRCODE_DUPLICATE_FILE,
|
(errcode(ERRCODE_DUPLICATE_FILE),
|
||||||
errmsg("cannot rename to target file \"%s\"",
|
errmsg("cannot rename to target file \"%s\"",
|
||||||
fn3 ? fn3 : fn2)));
|
fn3 ? fn3 : fn2)));
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ pg_file_rename(PG_FUNCTION_ARGS)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(ERRCODE_UNDEFINED_FILE,
|
(errcode(ERRCODE_UNDEFINED_FILE),
|
||||||
errmsg("renaming \"%s\" to \"%s\" was reverted",
|
errmsg("renaming \"%s\" to \"%s\" was reverted",
|
||||||
fn2, fn3)));
|
fn2, fn3)));
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ PageIsVerified(Page page, BlockNumber blkno)
|
|||||||
if (checksum_failure)
|
if (checksum_failure)
|
||||||
{
|
{
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
(ERRCODE_DATA_CORRUPTED,
|
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||||
errmsg("page verification failed, calculated checksum %u but expected %u",
|
errmsg("page verification failed, calculated checksum %u but expected %u",
|
||||||
checksum, p->pd_checksum)));
|
checksum, p->pd_checksum)));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user