Cleaning up missing ERRCODE assignments
I believe we have a project policy that all user-facing error reports
should go through ereport not elog (so that they're translatable) and
should not have ERRCODE_INTERNAL_ERROR as SQLSTATE. It's sometimes
debatable where the line is between user-facing and not, but surely any
error that is triggered by the standard regression tests has to be
considered user-facing. Yet running the tests with log_error_verbosity
set to verbose turns up quite a few XX000 log entries.
The attached patch fixes all the cases exposed by the regression tests.
I also went through each affected file and adjusted any other elog or
ereport calls that seemed to need it, on the theory that such oversights
probably travel in herds. I don't pretend that this is a complete fix,
but it's at least a down payment on the problem.
Probably the main thing that's worth discussing here is what to do in
plperl/plpython/pltcl when reporting an error thrown from the respective
language interpreter; in most cases we don't have a clear idea what
SQLSTATE should be used, but that doesn't make ERRCODE_INTERNAL_ERROR an
acceptable choice. I used ERRCODE_EXTERNAL_ROUTINE_EXCEPTION where there
was not an obviously better candidate, but I wonder if anyone has a
different idea?
I propose to back-patch this into 9.5, but not further; it's not an
important enough issue to justify changing SQLSTATE behavior in stable
branches.
regards, tom lane
Attachments:
errcode-cleanups-1.patchtext/x-diff; charset=us-ascii; name=errcode-cleanups-1.patchDownload+273-273
On Sat, Aug 1, 2015 at 8:39 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
I propose to back-patch this into 9.5, but not further; it's not an
important enough issue to justify changing SQLSTATE behavior in stable
branches.
+1. As I've said in the past, I think that making it possible to
determine mechanically that a "can't happen" error has in fact
occurred is of huge value to the project.
--
Peter Geoghegan
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers