Skip to content

Conversation

marceloneppel
Copy link
Member

@marceloneppel marceloneppel commented Sep 26, 2025

Issue

With the new predefined roles implemented for PG 16, if a client app requests a database called databases while the PG charm tries to set up the roles for it, a failure will happen because one of the roles will conflict with the already existing charmed_databases_owner role (responsible for owning all the databases).

Solution

Add 'databases' to the invalid database names list.

This is a fix for what was discussed on canonical/postgresql-k8s-operator#1107 (comment).

Follow-up PRs on PG VM and K8s repos:

Also, constants were added for the different substrates (VM and K8s). This allows the lib to know when it's needed to fix permissions (like for the temp storage in VM, when it's tmpfs).

Checklist

  • I have added or updated any relevant documentation.
  • I have cleaned any remaining cloud resources from my accounts.

Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Copy link

codecov bot commented Sep 26, 2025

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 46.72%. Comparing base (fb3c7f8) to head (ba6d9be).
⚠️ Report is 1 commits behind head on 16/edge.

Files with missing lines Patch % Lines
single_kernel_postgresql/utils/postgresql.py 80.00% 0 Missing and 1 partial ⚠️

❌ Your project status has failed because the head coverage (46.72%) is below the target coverage (70.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           16/edge      #18      +/-   ##
===========================================
+ Coverage    46.32%   46.72%   +0.39%     
===========================================
  Files            4        4              
  Lines          803      809       +6     
  Branches        94       94              
===========================================
+ Hits           372      378       +6     
  Misses         414      414              
  Partials        17       17              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
…tion to limit the check only for VM

Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
Signed-off-by: Marcelo Henrique Neppel <[email protected]>
@marceloneppel marceloneppel changed the title Add 'databases' to invalid database names list Add 'databases' to the invalid database names list Oct 2, 2025
@marceloneppel marceloneppel changed the title Add 'databases' to the invalid database names list [DPE-8473] Add 'databases' to the invalid database names list Oct 2, 2025
@marceloneppel marceloneppel marked this pull request as ready for review October 2, 2025 15:35
Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

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

LGTM, tnx @marceloneppel for the quick protection here!

}

INVALID_DATABASE_NAME_BLOCKING_MESSAGE = "invalid database name"
INVALID_DATABASE_NAMES = ["databases", "postgres", "template0", "template1"]
Copy link
Contributor

Choose a reason for hiding this comment

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

@7annaba3l JFYI, side-effect from charmed_databases_owner spec.
CC: @delgod

@marceloneppel marceloneppel merged commit 42b7e00 into 16/edge Oct 6, 2025
6 of 7 checks passed
@marceloneppel marceloneppel deleted the add-invalid-database-name branch October 6, 2025 12:36
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.

3 participants