summaryrefslogtreecommitdiff
path: root/contrib/adminpack/adminpack.c
diff options
context:
space:
mode:
authorAmit Kapila2020-03-18 03:57:14 +0000
committerAmit Kapila2020-03-18 03:57:14 +0000
commitb4f140869f5da081c27c344587b0ff1a02821776 (patch)
treef5d1fc73a869be7d8c22ba49b59d7fc88da178ef /contrib/adminpack/adminpack.c
parentfdeeb524b4e28affc527548af389c75e0a99c340 (diff)
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
Diffstat (limited to 'contrib/adminpack/adminpack.c')
-rw-r--r--contrib/adminpack/adminpack.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/adminpack/adminpack.c b/contrib/adminpack/adminpack.c
index 7d0a19b2949..3f4b06fdbbd 100644
--- a/contrib/adminpack/adminpack.c
+++ b/contrib/adminpack/adminpack.c
@@ -184,7 +184,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");
@@ -340,7 +340,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)));
}
@@ -371,7 +371,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)));
}