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 | 09cecdf285ea9f51aed669f9ea1ba840197d49d0 (patch) | |
tree | 3ae143caf62089b9579acee6b52a92ad2975a6d8 /src/backend/commands/vacuum.c | |
parent | 690ed2b76ab91eb79ea04ee2bfbdc8a2693f2a37 (diff) | |
download | postgresql-09cecdf285ea9f51aed669f9ea1ba840197d49d0.tar.gz postgresql-09cecdf285ea9f51aed669f9ea1ba840197d49d0.zip |
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/commands/vacuum.c')
-rw-r--r-- | src/backend/commands/vacuum.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index baf66f1e6c0..85b04832479 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -180,7 +180,10 @@ vacuum(int options, RangeVar *relation, Oid relid, VacuumParams *params, * calls a hostile index expression that itself calls ANALYZE. */ if (in_vacuum) - elog(ERROR, "%s cannot be executed from VACUUM or ANALYZE", stmttype); + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("%s cannot be executed from VACUUM or ANALYZE", + stmttype))); /* * Send info about dead objects to the statistics collector, unless we are |