Subject: dropuser error

From: Sam Stearns <[email-masked]>
Date: Tue, 16 Sep 2025 13:13:58 -0700

Howdy,

I'm trying to drop a user but getting the following error:

dropuser: error: removal of role "dalec" failed: ERROR:  role "dalec"
cannot be dropped because some objects depend on it
DETAIL:  262 objects in database csbtest

I have run queries to check for ownership on tables, views, sequences,
materialized views, functions, and schemas.  All return 0 (zero) rows.

Could anyone provide any advice here, please?

Thank you,

Sam

-- 

Samuel Stearns
Team Lead - Database
c: 971 762 6879 | o: 971 762 6879 | DAT.com

<https://www.dat.com/?utm_medium=email&utm_source=DAT_email_signature_link>

---

From: sami l <[email-masked]>
Date: Tue, 16 Sep 2025 23:26:08 +0300

Hi,
Did you check the priviliges?

*Sami LEKESİZ*

---

From: Tom Lane <[email-masked]>
Date: Tue, 16 Sep 2025 17:27:05 -0400

> DETAIL:  262 objects in database csbtest

If the display looks like that rather than itemizing the objects,
it's because they are in a different database of the cluster.
You need to connect to the "csbtest" database and then you can
drop or reassign ownership of those objects.

(The subtext here is that users/roles are shared across the
whole cluster, but most object kinds are local to one database.
You can't "see" the details of objects in a different database
than the one you're connected to.  DROP USER knows that there
are some dependencies, but not much more.)

			regards, tom lane

---

From: Naveen Kumar <[email-masked]>
Date: Wed, 17 Sep 2025 03:00:05 +0530

Check in *csbtest *DB for dependent objects. And there might be default
privileges set for that role.

Thanks & Regards,
Naveen Kumar .M,
Lead DBA
Mobile: 7755929449.