Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Utjxk-00084h-Qc for pgsql-admin@arkaria.postgresql.org; Mon, 01 Jul 2013 19:40:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Utjxk-0006qJ-Am for pgsql-admin@arkaria.postgresql.org; Mon, 01 Jul 2013 19:40:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Utjxj-0006q0-JV for pgsql-admin@postgresql.org; Mon, 01 Jul 2013 19:40:35 +0000 Received: from sam.nabble.com ([216.139.236.26]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Utjvz-0007PL-Ca for pgsql-admin@postgresql.org; Mon, 01 Jul 2013 19:40:33 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1Utjvx-00082z-QT for pgsql-admin@postgresql.org; Mon, 01 Jul 2013 12:38:45 -0700 Date: Mon, 1 Jul 2013 12:38:45 -0700 (PDT) From: David Johnston To: pgsql-admin@postgresql.org Message-ID: <1372707525814-5762105.post@n5.nabble.com> In-Reply-To: <20130701173803.GI3757@eldon.alvh.no-ip.org> References: <59BF48FAC524384DA413D8F4F2E4BA6907D9A9DA@CINURCNA06.e2k.ad.ge.com> <1372697164049-5762060.post@n5.nabble.com> <20130701173803.GI3757@eldon.alvh.no-ip.org> Subject: Re: How was I able to drop a role even though objects depend on it? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: 1.8 (+) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Alvaro Herrera-9 wrote > David Johnston wrote: >> Wojciechowski, Robert (GE Transportation) wrote >> > [...] there is a database that shows this connect grant to a user that >> was >> > known as foo1_userA (oid 3562339547): 3562339547=c/postgres >> >> The main user dependent situation is having said user OWNER on a database >> object. Simply giving a user connect privileges on a database does not >> make >> the database dependent upon said user and so removing said user remains >> possible. > > Dropping a user which is either a database owner or has been granted > CONNECT privileges is supposed to be disallowed: > > alvherre=# create user f; > CREATE ROLE > alvherre=# create database f owner f; > CREATE DATABASE > alvherre=# drop role f; > ERROR: role "f" cannot be dropped because some objects depend on it > DETALLE: owner of database f > alvherre=# create role g; > CREATE ROLE > alvherre=# grant connect on database f to g; > GRANT > alvherre=# drop role g; > ERROR: role "g" cannot be dropped because some objects depend on it > DETALLE: privileges for database f > > We're supposed to have sufficient locking so that concurrent > transactions don't see problems either (one xact drops the user while > the other creates the database), but maybe there are bugs somewhere. OK. Looking at the documentation for this I see where this is stated though I read it that only direct permissions are evaluated. If foo1_userA is getting permission to connect to database "postgres" via a parent role then foo1_userA can be dropped since it would not need/have direct connect privileges but would still how up as being allowed by the system. I don't know whether 3562339547 = c/postgres would show up only in the direct case or if also via inheritance - and I'm not totally sure where this is actually being queried in the first place. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/How-was-I-able-to-drop-a-role-even-though-objects-depend-on-it-tp5762049p5762105.html Sent from the PostgreSQL - admin mailing list archive at Nabble.com. -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin