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: 0001-polish-the-error-message-of-creating-proc.patch
Description: Binary data

Reply via email to