Skip to content

Use an appropriate errorcode when failing to unset principal key or removing a key provider #485

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

AndersAstrand
Copy link
Collaborator

Also fix an error message that didn't follow the style guide https://www.postgresql.org/docs/17/error-style-guide.html

Error messages are not supposed to be proper sentences, and according to
the error style guide "cannot" is preferable over "can't".

Also add an appropriate errcode.
ERRCODE_OBJECT_IN_USE seems appropriate for this as it's also used for
things like replication slots and not only database objects.
@AndersAstrand AndersAstrand changed the title Use an appropriate errocode when failing to unset principal key or removing a key provider Use an appropriate errorcode when failing to unset principal key or removing a key provider Jul 24, 2025
@@ -706,6 +706,7 @@ pg_tde_delete_key(PG_FUNCTION_ARGS)
if (default_principal_key == NULL)
{
ereport(ERROR,
errcode(ERRCODE_OBJECT_IN_USE),
errmsg("cannot delete principal key"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also get "which is currently in use"?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like that is not a common PG way of writing it, so probably not. But maybe it should still be improved.

@AndersAstrand AndersAstrand merged commit 96e4944 into percona:TDE_REL_17_STABLE Jul 25, 2025
17 of 19 checks passed
@AndersAstrand AndersAstrand deleted the tde/errcode-when-failing-to-delete-key-or-provider branch July 25, 2025 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants