(MODULES-11935) Fix default_privileges idempotency on PostgreSQL 17 - #1701
Open
imaqsood wants to merge 1 commit into
Open
(MODULES-11935) Fix default_privileges idempotency on PostgreSQL 17#1701imaqsood wants to merge 1 commit into
imaqsood wants to merge 1 commit into
Conversation
PostgreSQL 17 added the MAINTAIN privilege ('m') to the set of table
privileges, so `ALTER DEFAULT PRIVILEGES ... GRANT ALL ON TABLES` now
records `role=arwdDxtm/grantor` in pg_default_acl.defaclacl.
The hard-coded `arwdDxt` in the `unless` query no longer matched, so the
grant was re-applied on every run and postgresql::server::default_privileges
was never idempotent on Debian 13 and other PostgreSQL 17+ platforms.
Version-gate the check string, and make the acceptance spec's check
queries derive it from the running server version. Legacy dotless 9.x
version strings (e.g. '96' on SLES) are normalised before comparison so
they are not mistaken for a version above 17.
Co-Authored-By: Claude <noreply@anthropic.com>
imaqsood
requested review from
a team,
SimonHoenscheid,
alexjfisher,
bastelfreak,
deric,
ekohl and
smortex
as code owners
August 28, 2026 11:05
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes MODULES-11935.
Problem
postgresql::server::default_privilegeswithprivilege => 'ALL'andobject_type => 'TABLES'is not idempotent on PostgreSQL 17+. TheALTER DEFAULT PRIVILEGEScommand re-runs on every Puppet run.PostgreSQL 17 added the
MAINTAINprivilege, abbreviatedm, to the table privilege set.ALL ON TABLEStherefore recordsrole=arwdDxtm/grantorinpg_default_acl.defaclacl, but theunlessquery hard-codedarwdDxt, so it never matched.This is pre-existing on
main— it is currently failing the Debian-13 acceptance jobs in nightly, e.g. run 32823034551 (6 of 60 examples, allTABLEScases inspec/acceptance/server/default_privileges_spec.rb; theSCHEMAScases pass becauseALL ON SCHEMASis stillUC).Change
manifests/server/default_privileges.pp: version-gate the check string so PostgreSQL >= 17 expectsarwdDxtm. Legacy dotless 9.x version strings ('96'on SLES, etc.) are normalised to9.6first soversioncmpdoes not read them as newer than 17.spec/acceptance/server/default_privileges_spec.rb: derive the expected ACL frompostgresql_versioninstead of hard-coding it, in all three check queries.spec/defines/server/default_privileges_spec.rb+spec/spec_helper_local.rb: add aDebian 13shared context (PostgreSQL 17) and a unit example asserting thearwdDxtmunlessclause. Existing Debian 11 (PostgreSQL 13) expectations are unchanged.Checklist
bundle exec rspec spec/defines spec/classes→ 468 examples, 0 failures (puppet ~> 8.0, facter 4.10). New PG-17 example verified to fail before the manifest change and pass after.Not in scope
Three other jobs are red in that run for unrelated pre-existing reasons, left alone here:
puppetcore8:litmusimageEL7 containers cannot start systemd on the cgroup-v2 GitHub runner (Failed to get D-Bus connection: Operation not permitted). RedHat-7 passes because it is provisioned as a real VM.🤖 Generated with Claude Code