Skip to content

Commit b4f1408

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 fdeeb52 commit b4f1408

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

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

190190
f = AllocateFile(filename, "wb");
@@ -340,7 +340,7 @@ pg_file_rename_internal(text *file1, text *file2, text *file3)
340340
if (rc >= 0 || errno != ENOENT)
341341
{
342342
ereport(ERROR,
343-
(ERRCODE_DUPLICATE_FILE,
343+
(errcode(ERRCODE_DUPLICATE_FILE),
344344
errmsg("cannot rename to target file \"%s\"",
345345
fn3 ? fn3 : fn2)));
346346
}
@@ -371,7 +371,7 @@ pg_file_rename_internal(text *file1, text *file2, text *file3)
371371
else
372372
{
373373
ereport(ERROR,
374-
(ERRCODE_UNDEFINED_FILE,
374+
(errcode(ERRCODE_UNDEFINED_FILE),
375375
errmsg("renaming \"%s\" to \"%s\" was reverted",
376376
fn2, fn3)));
377377
}

src/backend/storage/page/bufpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ PageIsVerified(Page page, BlockNumber blkno)
141141
if (checksum_failure)
142142
{
143143
ereport(WARNING,
144-
(ERRCODE_DATA_CORRUPTED,
144+
(errcode(ERRCODE_DATA_CORRUPTED),
145145
errmsg("page verification failed, calculated checksum %u but expected %u",
146146
checksum, p->pd_checksum)));
147147

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy