diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-07-04 09:48:40 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-07-04 09:48:40 +0900 |
commit | b81a71aa05f294705e1b1d4fe24548f175f9bfe9 (patch) | |
tree | 8d1c94fdfd570891b7b2e5b7f079eaf252e018b8 /src/backend/commands/trigger.c | |
parent | 6897f0ec024582a570868939d3f34a6853374723 (diff) | |
download | postgresql-b81a71aa05f294705e1b1d4fe24548f175f9bfe9.tar.gz postgresql-b81a71aa05f294705e1b1d4fe24548f175f9bfe9.zip |
Assign error codes where missing for user-facing failures
All the errors triggered in the code paths patched here would cause the
backend to issue an internal_error errcode, which is a state that should
be used only for "can't happen" situations. However, these code paths
are reachable by the regression tests, and could be seen by users in
valid cases. Some regression tests expect internal errcodes as they
manipulate the backend state to cause corruption (like checksums), or
use elog() because it is more convenient (like injection points), these
have no need to change.
This reduces the number of internal failures triggered in a check-world
by more than half, while providing correct errcodes for these valid
cases.
Reviewed-by: Robert Haas
Discussion: https://postgr.es/m/Zic_GNgos5sMxKoa@paquier.xyz
Diffstat (limited to 'src/backend/commands/trigger.c')
-rw-r--r-- | src/backend/commands/trigger.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index 58b7fc5bbd5..170360edda8 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -1519,6 +1519,7 @@ renametrig(RenameStmt *stmt) */ if (OidIsValid(trigform->tgparentid)) ereport(ERROR, + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot rename trigger \"%s\" on table \"%s\"", stmt->subname, RelationGetRelationName(targetrel)), errhint("Rename the trigger on the partitioned table \"%s\" instead.", |