puppetlabs / puppetlabs-postgresql

Puppet module for managing PostgreSQL
Apache License 2.0
228 stars 614 forks source link

Allow empty string value for config entries #1603

Open antaflos opened 4 months ago

antaflos commented 4 months ago

Summary

PostgreSQL supports and allows config entries, such as those in postgresql.conf, to be set to the empty string. The postgresql::server::config_entry defined type, however, requires String[1] when supplying string values. This doesn't allow for the empty string.

This change relaxes the allowed data types for the value parameter of postgresql::server::config_entry to String from String[1] and adds a spec test to support the change.

Related Issues (if any)

1602

Checklist

antaflos commented 4 months ago

I don't think I can do anything about the failing tests (labeller and mend). The rest looks good.

bastelfreak commented 3 months ago

@antaflos can you please document in the spec test some examples of options where this makes sense? And please rebase after https://github.com/puppetlabs/puppetlabs-postgresql/pull/1599 got merged.

antaflos commented 2 months ago

@bastelfreak Will do. Our use case for empty strings here is that we have applications that use transaction-bound session variables, as in SET LOCAL awsome_app.auth_user_id = 123456 and SET LOCAL awesome_app.tenant_id = 893745. This pertains to auditability and row-level security.

PostgreSQL 13 (and possibly newer versions also) requires such session variables to be defined beforehand and initialised with a default value, such as the empty string, in postgresql.conf.