Re: Error detail/hint style fixup - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Error detail/hint style fixup
Date
Msg-id 2957.1521478072@sss.pgh.pa.us
Whole thread Raw
In response to Error detail/hint style fixup  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Error detail/hint style fixup  (Daniel Gustafsson <daniel@yesql.se>)
List 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 by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Problems with Error Messages wrt Domains, Checks
Next
From: John Naylor
Date:
Subject: Re: MCV lists for highly skewed distributions