Skip to content

Set database owner to fix PG 15+ schema permissions - #284

Merged
evgeni merged 1 commit into
theforeman:masterfrom
zjhuntin:fix/pg16-db-owner-permission
Jul 15, 2026
Merged

Set database owner to fix PG 15+ schema permissions#284
evgeni merged 1 commit into
theforeman:masterfrom
zjhuntin:fix/pg16-db-owner-permission

Conversation

@zjhuntin

Copy link
Copy Markdown
Contributor

Summary

  • Add owner parameter to postgresql::server::db resource so the candlepin database is owned by the candlepin user instead of postgres
  • PostgreSQL 15+ revokes CREATE on the public schema by default — only the database owner retains it
  • Without this fix, candlepin cannot create tables in the public schema when running against PG 15+

Root Cause

The public schema in PG 15+ is owned by pg_database_owner, a special role that maps to the database owner. When the database is owned by postgres (the default when owner is not set), the candlepin user has no CREATE privilege on the public schema.

Note: puppet-foreman already sets owner correctly — this aligns puppet-candlepin with that pattern.

Test plan

  • Verified fix on a RHEL 9.8 instance with PG 16 — installer completed successfully after patching this file
  • Existing rspec tests pass (they check resource existence, not parameters)

🤖 Generated with Claude Code

PostgreSQL 15+ revokes CREATE on the public schema from all users
except the database owner. Without setting owner, the database is
owned by postgres and the candlepin user cannot create tables.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@evgeni

evgeni commented Jul 15, 2026

Copy link
Copy Markdown
Member

Where did you end up with Candlepin running against PostgreSQL 16, while deployed by Puppet?

The fix is correct, I am mostly curious why it was needed.

@evgeni
evgeni merged commit 072f08a into theforeman:master Jul 15, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants