Skip to content

Commit e378241

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 c5b6b9c commit e378241

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
@@ -187,7 +187,7 @@ pg_file_write_internal(text *file, text *data, bool replace)
187187

188188
if (stat(filename, &fst) >= 0)
189189
ereport(ERROR,
190-
(ERRCODE_DUPLICATE_FILE,
190+
(errcode(ERRCODE_DUPLICATE_FILE),
191191
errmsg("file \"%s\" exists", filename)));
192192

193193
f = AllocateFile(filename, "wb");
@@ -319,7 +319,7 @@ pg_file_rename_internal(text *file1, text *file2, text *file3)
319319
if (rc >= 0 || errno != ENOENT)
320320
{
321321
ereport(ERROR,
322-
(ERRCODE_DUPLICATE_FILE,
322+
(errcode(ERRCODE_DUPLICATE_FILE),
323323
errmsg("cannot rename to target file \"%s\"",
324324
fn3 ? fn3 : fn2)));
325325
}
@@ -350,7 +350,7 @@ pg_file_rename_internal(text *file1, text *file2, text *file3)
350350
else
351351
{
352352
ereport(ERROR,
353-
(ERRCODE_UNDEFINED_FILE,
353+
(errcode(ERRCODE_UNDEFINED_FILE),
354354
errmsg("renaming \"%s\" to \"%s\" was reverted",
355355
fn2, fn3)));
356356
}

src/backend/storage/page/bufpage.c

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

0 commit comments

Comments
 (0)