Re: Error detail/hint style fixup

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error detail/hint style fixup
Date: 2018-03-19 16:47:52
Message-ID: 2957.1521478072@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Daniel Gustafsson <daniel(at)yesql(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2018-03-19 16:59:17 Re: MCV lists for highly skewed distributions
Previous Message David G. Johnston 2018-03-19 16:32:53 Re: Problems with Error Messages wrt Domains, Checks