[PATCH] polish the error message of creating proc - Mailing list pgsql-hackers

From Junwang Zhao
Subject [PATCH] polish the error message of creating proc
Date
Msg-id CAEG8a3K6kQmFJz6D2VB50wQTN6VRBGC7C+DBh20kkxH-1haW8Q@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] polish the error message of creating proc
List pgsql-hackers
when a error occurs when creating proc, it should point out the
specific proc kind instead of just printing "function".

diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index a9fe45e347..58af4b48ce 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -373,7 +373,11 @@ ProcedureCreate(const char *procedureName,
                if (!replace)
                        ereport(ERROR,
                                        (errcode(ERRCODE_DUPLICATE_FUNCTION),
-                                        errmsg("function \"%s\"
already exists with same argument types",
+                                        errmsg("%s \"%s\" already
exists with same argument types",
+
(oldproc->prokind == PROKIND_AGGREGATE ? "aggregate function" :
+
oldproc->prokind == PROKIND_PROCEDURE ? "procedure" :
+
oldproc->prokind == PROKIND_WINDOW ? "window function" :
+                                                        "function"),
                                                        procedureName)));
                if (!pg_proc_ownercheck(oldproc->oid, proowner))
                        aclcheck_error(ACLCHECK_NOT_OWNER, OBJECT_FUNCTION,

-- 
Regards
Junwang Zhao

Attachment

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Hash index build performance tweak from sorting
Next
From: "kuroda.hayato@fujitsu.com"
Date:
Subject: RE: [Proposal] Add foreign-server health checks infrastructure