Re: Error detail/hint style fixup

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Error detail/hint style fixup
Дата
Msg-id 2957.1521478072@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Error detail/hint style fixup  (Daniel Gustafsson <daniel@yesql.se>)
Ответы Re: Error detail/hint style fixup  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
> Attached patch ensures that (i) details and hints have leading capitalization,
> have double spaces after punctuation and ends with period; (ii) context should
> not be capitalized and should not end with period; (iii) test .out files match
> the changes.

+1 for cleaning this up, but I wonder if you've gone far enough in
adjusting the style of errcontext() messages.  The style guide says
"Context strings should normally not be complete sentences", with
the expectation that we're typically going to concatenate several
of them into what amounts to a stack trace.  And while the guide
doesn't say in so many words "describe the context in which the
error occurred", that's surely what you're supposed to do.
So I'm thinking that, eg,

-         errcontext("Error occurred on dblink connection named \"%s\": %s.",
+         errcontext("error occurred on dblink connection named \"%s\": %s",
                     dblink_context_conname, dblink_context_msg)));

is not getting the job done; at least the "error occurred" part is simply
redundant given that this is a context string.  Looking at the actual uses
of this, eg

 NOTICE:  relation "foobar" does not exist
-CONTEXT:  Error occurred on dblink connection named "unnamed": could not open cursor.
+CONTEXT:  error occurred on dblink connection named "unnamed": could not open cursor

I'm thinking what we should actually be printing is more like

CONTEXT:  while opening cursor on dblink connection named "unnamed"

That'd require fixing the callers of this subroutine too, but maybe
it's worth doing.

            regards, tom lane


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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Problems with Error Messages wrt Domains, Checks
Следующее
От: John Naylor
Дата:
Сообщение: Re: MCV lists for highly skewed distributions