dalibo / ldap2pg

:elephant: :busts_in_silhouette: Manage PostgreSQL roles and privileges from YAML or LDAP
https://labs.dalibo.com/ldap2pg
PostgreSQL License
204 stars 33 forks source link

Drop schema cascade? #606

Closed seanzechman closed 4 months ago

seanzechman commented 5 months ago

Not sure if it is a bug or not. Our situation might be unique.

We create personal schemas on first login with personal account that has been created with ldap2pg. This is done with a login trigger.

If user leaves the organization then their account is no longer part of LDAP group used by ldap2pg to create/drop accounts.

When ldap2pg runs I see it reassigns objects but it does not do anything with the schema and then cannot cleanup the user appropriately.

2024-04-08 15:08:20,743 CHANGE: Terminate running sessions for my_user. 2024-04-08 15:08:20,833 CHANGE: Reassign my_user's objects and purge ACL in postgres. 2024-04-08 15:08:20,834 CHANGE: Drop my_user. 2024-04-08 15:08:20,835 CRITICAL: Error while executing SQL query: 2024-04-08 15:08:20,835 CRITICAL: role "my_user" cannot be dropped because some objects depend on it 2024-04-08 15:08:20,835 CRITICAL: DETAIL: 1 object in database my_database

my_database=# drop schema my_user; DROP SCHEMA my_database=# drop role my_user; DROP ROLE my_database=# exit

Is there a way to have drop schema cascade? I saw notes about it in #171 but that was closed

bersace commented 5 months ago

Is my_database returned by databases_query ?