Re: [PATCH] polish the error message of creating proc

Поиск
Список
Период
Сортировка
От Junwang Zhao
Тема Re: [PATCH] polish the error message of creating proc
Дата
Msg-id CAEG8a3LCV8mDD+nU73SZcbiJNZ6eQ9T5qOp=bC12-tCqed4s0Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] polish the error message of creating proc  (Julien Rouhaud <rjuju123@gmail.com>)
Ответы Re: [PATCH] polish the error message of creating proc  (Julien Rouhaud <rjuju123@gmail.com>)
Re: [PATCH] polish the error message of creating proc  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Sep 21, 2022 at 8:17 PM Julien Rouhaud <rjuju123@gmail.com> wrote:
>
> Hi,
>
> On Wed, Sep 21, 2022 at 07:45:01PM +0800, Junwang Zhao wrote:
> > when a error occurs when creating proc, it should point out the
> > specific proc kind instead of just printing "function".
>
> You should have kept the original thread in copy (1), or at least mention it.

Yeah, thanks for pointing that out, will do that next time.

>
> > 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,
>
> You can't put part of the message in parameter, as the resulting string isn't
> translatable.  You should either use "routine" as a generic term or provide 3
> different full messages.

I noticed that there are some translations under the backend/po directory,
can we just change
msgid "function \"%s\" already exists with same argument types"
to
msgid "%s \"%s\" already exists with same argument types" ?

>
> [1] https://www.postgresql.org/message-id/29ea5666.6ce8.1835f4b4992.Coremail.qtds_126@126.com



-- 
Regards
Junwang Zhao



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: why can't a table be part of the same publication as its schema
Следующее
От: Zhang Mingli
Дата:
Сообщение: Re: Removing unused parameter in SnapBuildGetOrBuildSnapshot