Re: Missing errcode() in ereport

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: Missing errcode() in ereport
Дата
Msg-id CAMsr+YFypZJXfT18OrXgZzc0XULw1Eppjwg0sizuBz5Lnb3KJw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Missing errcode() in ereport  (Andres Freund <andres@anarazel.de>)
Ответы Re: Missing errcode() in ereport  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Missing errcode() in ereport  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers


On Fri, 20 Mar 2020, 01:59 Andres Freund, <andres@anarazel.de> wrote:
Hi,

On 2020-03-17 10:09:18 -0400, Tom Lane wrote:
> We might want to spend some effort thinking how to find or prevent
> additional bugs of the same ilk ...

Yea, that'd be good.  Trying to help people new to postgres write their
first patches I found that ereport is very confusing to them - largely
because the syntax doesn't make much sense. Made worse by the compiler
error messages being terrible in many cases.

Very much agreed.

I'd have found it helpful to just have the docs explain clearly how it works by chaining the comma operator using functions with ignored return values. 

That would also help people understand how they can make parts of an ereport conditional, e.g. only set errdetail() if there additional info is currently available W/O duplicating the rest of the ereport .


Not sure there's much we can do without changing ereport's "signature"
though :(

Regards,

Andres


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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: [PATCH] Support built control file in PGXS VPATH builds
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Missing errcode() in ereport