Skip to content

Commit 569f935

Browse files
author
Amit Kapila
committed
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
1 parent 3c871d1 commit 569f935

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

contrib/adminpack/adminpack.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pg_file_write(PG_FUNCTION_ARGS)
128128

129129
if (stat(filename, &fst) >= 0)
130130
ereport(ERROR,
131-
(ERRCODE_DUPLICATE_FILE,
131+
(errcode(ERRCODE_DUPLICATE_FILE),
132132
errmsg("file \"%s\" exists", filename)));
133133

134134
f = AllocateFile(filename, "wb");
@@ -194,7 +194,7 @@ pg_file_rename(PG_FUNCTION_ARGS)
194194
if (rc >= 0 || errno != ENOENT)
195195
{
196196
ereport(ERROR,
197-
(ERRCODE_DUPLICATE_FILE,
197+
(errcode(ERRCODE_DUPLICATE_FILE),
198198
errmsg("cannot rename to target file \"%s\"",
199199
fn3 ? fn3 : fn2)));
200200
}
@@ -225,7 +225,7 @@ pg_file_rename(PG_FUNCTION_ARGS)
225225
else
226226
{
227227
ereport(ERROR,
228-
(ERRCODE_UNDEFINED_FILE,
228+
(errcode(ERRCODE_UNDEFINED_FILE),
229229
errmsg("renaming \"%s\" to \"%s\" was reverted",
230230
fn2, fn3)));
231231
}

src/backend/storage/page/bufpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ PageIsVerified(Page page, BlockNumber blkno)
147147
if (checksum_failure)
148148
{
149149
ereport(WARNING,
150-
(ERRCODE_DATA_CORRUPTED,
150+
(errcode(ERRCODE_DATA_CORRUPTED),
151151
errmsg("page verification failed, calculated checksum %u but expected %u",
152152
checksum, p->pd_checksum)));
153153

0 commit comments

Comments
 (0)