diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-08-02 23:49:19 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-08-02 23:49:19 -0400 |
commit | 89e80b03297555277473fc3978b83c68ec9847b8 (patch) | |
tree | 3d83744f8f80cc85eb31864340760df7029f6e3b /src/backend/access/heap/heapam.c | |
parent | c75b1f75b3d159c0e71c1ec7f42c922bce448d89 (diff) |
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.
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r-- | src/backend/access/heap/heapam.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 050efdc4806..3701d8e59d5 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -2801,7 +2801,9 @@ l1: if (result == HeapTupleInvisible) { UnlockReleaseBuffer(buffer); - elog(ERROR, "attempted to delete invisible tuple"); + ereport(ERROR, + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("attempted to delete invisible tuple"))); } else if (result == HeapTupleBeingUpdated && wait) { @@ -3343,7 +3345,9 @@ l2: if (result == HeapTupleInvisible) { UnlockReleaseBuffer(buffer); - elog(ERROR, "attempted to update invisible tuple"); + ereport(ERROR, + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("attempted to update invisible tuple"))); } else if (result == HeapTupleBeingUpdated && wait) { |