aws / pg_tle

Framework for building trusted language extensions for PostgreSQL
Apache License 2.0
333 stars 31 forks source link

Warn the user if a hook function is registered but a necessary parameter is not enabled #269

Closed adamguo0 closed 6 months ago

adamguo0 commented 6 months ago

Describe the problem

Currently a user can register a hook function regardless of whether the necessary parameters are enabled. For instance, a user can register a clientauth function without setting pgtle.enable_clientauth or pgtle.clientauth_db_name, both of which are needed to enable the clientauth feature. This can be confusing for users who are not familiar with the feature.

Describe the proposal

Emit a WARNING when registering a hook function if the parameters aren't enabled.

These warnings will help to preempt configuration errors.

Relevant code: https://github.com/aws/pg_tle/blob/main/pg_tle--1.1.1.sql#L601-L630

Describe alternatives

Currently a user can read the documentation https://github.com/aws/pg_tle/blob/main/docs/04_hooks.md to debug their configuration. However we should still try to make the user experience smoother with some helpful hints.