Fix a number of places that produced XX000 errors in the regression tests.
Tom Lane <tgl@sss.pgh.pa.us>
Fix a number of places that produced XX000 errors in the regression tests. It's against project policy to use elog() for user-facing errors, or to omit an errcode() selection for errors that aren't supposed to be "can't happen" cases. Fix all the violations of this policy that result in ERRCODE_INTERNAL_ERROR log entries during the standard regression tests, as errors that can reliably be triggered from SQL surely should be considered user-facing. I also looked through all the files touched by this commit and fixed other nearby problems of the same ilk. I do not claim to have fixed all violations of the policy, just the ones in these files. In a few places I also changed existing ERRCODE choices that didn't seem particularly appropriate; mainly replacing ERRCODE_SYNTAX_ERROR by something more specific. Back-patch to 9.5, but no further; changing ERRCODE assignments in stable branches doesn't seem like a good idea.
Files
| Path | Change | +/− |
|---|---|---|
| contrib/tablefunc/tablefunc.c | modified | +25 −15 |
| src/backend/access/common/reloptions.c | modified | +12 −7 |
| src/backend/access/heap/heapam.c | modified | +6 −2 |
| src/backend/commands/copy.c | modified | +21 −11 |
| src/backend/commands/vacuum.c | modified | +4 −1 |
| src/backend/executor/execQual.c | modified | +4 −2 |
| src/backend/utils/adt/txid.c | modified | +9 −4 |
| src/pl/plperl/plperl.c | modified | +47 −23 |
| src/pl/plpython/plpy_elog.c | modified | +1 −1 |
| src/pl/plpython/plpy_exec.c | modified | +8 −4 |
| src/pl/tcl/pltcl.c | modified | +35 −16 |
| src/test/regress/expected/txid.out | modified | +5 −5 |
| src/test/regress/regress.c | modified | +4 −2 |