git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 974c8ea)
Add missing errcode() in a few ereport calls.
2020年3月18日 04:07:08 +0000 (09:37 +0530)
2020年3月18日 04:07:08 +0000 (09:37 +0530)
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


diff --git a/contrib/adminpack/adminpack.c b/contrib/adminpack/adminpack.c
index 4f613e240bbf788aaef42412b36b778ca8d6bdcd..d4b87b38bd6cb5530a01300bb2bf828be53040c7 100644 (file)
--- a/contrib/adminpack/adminpack.c
+++ b/contrib/adminpack/adminpack.c
@@ -187,7 +187,7 @@ pg_file_write_internal(text *file, text *data, bool replace)
if (stat(filename, &fst) >= 0)
ereport(ERROR,
- (ERRCODE_DUPLICATE_FILE,
+ (errcode(ERRCODE_DUPLICATE_FILE),
errmsg("file \"%s\" exists", filename)));
f = AllocateFile(filename, "wb");
@@ -319,7 +319,7 @@ pg_file_rename_internal(text *file1, text *file2, text *file3)
if (rc >= 0 || errno != ENOENT)
{
ereport(ERROR,
- (ERRCODE_DUPLICATE_FILE,
+ (errcode(ERRCODE_DUPLICATE_FILE),
errmsg("cannot rename to target file \"%s\"",
fn3 ? fn3 : fn2)));
}
@@ -350,7 +350,7 @@ pg_file_rename_internal(text *file1, text *file2, text *file3)
else
{
ereport(ERROR,
- (ERRCODE_UNDEFINED_FILE,
+ (errcode(ERRCODE_UNDEFINED_FILE),
errmsg("renaming \"%s\" to \"%s\" was reverted",
fn2, fn3)));
}
diff --git a/src/backend/storage/page/bufpage.c b/src/backend/storage/page/bufpage.c
index dfbda5458fdb253bcb08dbc42437d50b55bebc1e..d2ea38bdabcbac4550464fc64b883159923d66fd 100644 (file)
--- a/src/backend/storage/page/bufpage.c
+++ b/src/backend/storage/page/bufpage.c
@@ -147,7 +147,7 @@ PageIsVerified(Page page, BlockNumber blkno)
if (checksum_failure)
{
ereport(WARNING,
- (ERRCODE_DATA_CORRUPTED,
+ (errcode(ERRCODE_DATA_CORRUPTED),
errmsg("page verification failed, calculated checksum %u but expected %u",
checksum, p->pd_checksum)));
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /