pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: stan <stanb@panix.com>
Cc: pgsql-general@postgresql.org
Subject: Re: How to determine what is preventing deleting a rule
Date: Sat, 17 Aug 2019 19:49:06 -0400
Message-ID: <25628.1566085746@sss.pgh.pa.us> (raw)
In-Reply-To: <20190817233725.GA11582@panix.com>
References: <20190817233725.GA11582@panix.com>

stan <stanb@panix.com> writes:
> I have deleted,  what i thought were all the objects referenced by these roles,
> but I still get an error saying there is one object they reference.
> How can I find out what this object is?

The error should tell you, if you're connected to the database where
that object is.

regression=# create database d1;
CREATE DATABASE
regression=# create database d2;
CREATE DATABASE
regression=# create user joe;
CREATE ROLE
regression=# \c d2 joe
You are now connected to database "d2" as user "joe".
d2=> create table tt(d1 int);
CREATE TABLE
d2=> \c d1 postgres
You are now connected to database "d1" as user "postgres".
d1=# drop user joe;
ERROR:  role "joe" cannot be dropped because some objects depend on it
DETAIL:  1 object in database d2
d1=# \c d2
You are now connected to database "d2" as user "postgres".
d2=# drop user joe;
ERROR:  role "joe" cannot be dropped because some objects depend on it
DETAIL:  owner of table tt

Unfortunately, we can't see into the catalogs of a different database
to explain about dependencies there ...

			regards, tom lane





view thread (3+ messages)  latest in thread

Message-ID: <25628.1566085746@sss.pgh.pa.us>
Permalink:  ../25628.1566085746@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25628.1566085746@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, stanb@panix.com
  Subject: Re: How to determine what is preventing deleting a rule
  In-Reply-To: <25628.1566085746@sss.pgh.pa.us>
  References: <20190817233725.GA11582@panix.com> <25628.1566085746@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox