canonical / postgresql-operator

A Charmed Operator for running PostgreSQL on machines
https://charmhub.io/postgresql
Apache License 2.0
8 stars 19 forks source link

Large Objects ownership #348

Closed alexsander-souza closed 7 months ago

alexsander-souza commented 8 months ago

Steps to reproduce

  1. deploy postgresql charm (14/stable) in a VM
  2. deploy your application charm (MAAS, WIP, uses postgresql_client interface)
  3. integrate MAAS and postgresql
  4. use MAAS for a while, wait for it to create some Large Objects in the DB
  5. remove the MAAS application
  6. deploy MAAS again
  7. integrate MAAS and postgresql again (it requests the same DB name)

Expected behavior

The new deployment inherits the existing database with ownership of all existing Large Objects.

Actual behavior

When the application is removed the first time, postgresql drops its user. As result, all existing LO are inherited by the DB owner (operator) as seen in table pg_catalog.pg_largeobject_metadata. When the application is deployed again, postgresql creates a new user and grants all rights to it, but the LO objects remain owner by the operator user.

Versions

Operating system: Ubuntu 22.04.3 LTS

Juju CLI: 3.3.1-genericlinux-amd64

Juju agent: 3.3.1

Charm revision: 14.9

github-actions[bot] commented 8 months ago

https://warthogs.atlassian.net/browse/DPE-3544

marceloneppel commented 7 months ago

Hi @alexsander-souza! Can you try the following revision of PostgreSQL and see if it fixes the issue for you?

juju deploy postgresql --channel 14/edge/largeobjects --series jammy
alexsander-souza commented 7 months ago

I can confirm it fixes the issue. the new user inherits the existing LOs and can update them.

dragomirp commented 7 months ago

Hi, latest 14/edge (rev. 369) should have the fix.