Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z8BDp-0004IE-Vq for pgsql-admin@arkaria.postgresql.org; Thu, 25 Jun 2015 17:45:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z8BDp-0005IF-Ej for pgsql-admin@arkaria.postgresql.org; Thu, 25 Jun 2015 17:45:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z8BAc-0001lS-4w for pgsql-admin@postgresql.org; Thu, 25 Jun 2015 17:42:38 +0000 Received: from mail-ig0-x231.google.com ([2607:f8b0:4001:c05::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z8BAZ-0000TN-3s for pgsql-admin@postgresql.org; Thu, 25 Jun 2015 17:42:36 +0000 Received: by igblr2 with SMTP id lr2so60512574igb.0 for ; Thu, 25 Jun 2015 10:42:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=JQmiNVW3zuSFMkSBomOjVJ/GzNgiYvshBIWU2e5e9ww=; b=UEGbOQuN6alPIPWxEgClzB+NjPb83RHjtf+wl2/n1PK6yGVk2RueBsJLdf1e3mu/7A PAl4P7yoOLrvx7uc8k4oOMVJcB21/Aij5ZWEd03WCprHMeF9i4xnuCADyj0G04M0CIuS NEuufp5uKM1VWKE7JTx4k84eoDSRmP8mmaLKPlE7AGExaPk94cSoeGssK3pYkxoAC0RM xfzRr3xCiP6DH4wiFo1tDVV0I8P7w2JtZ4yNFiq7P+DyMmUbr5+0YdlNGedTI4jHYpyr 3WoxCYqAJmhDVVplwzOEucKXyU2r8oGlhHYlgdhwSJ6RCONsUAVCOsejjptIhT6HH4sR zG/w== X-Received: by 10.50.61.130 with SMTP id p2mr5787009igr.9.1435254154534; Thu, 25 Jun 2015 10:42:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.167.174 with HTTP; Thu, 25 Jun 2015 10:42:15 -0700 (PDT) In-Reply-To: <86r3ozhew5.fsf@jerry.enova.com> References: <558B6B19.1050305@gmail.com> <20150625030026.GI3289@postgresql.org> <86r3ozhew5.fsf@jerry.enova.com> From: John Scalia Date: Thu, 25 Jun 2015 10:42:15 -0700 Message-ID: Subject: Re: Trying to change the owner of some tables To: Jerry Sievers Cc: Alvaro Herrera , "pgsql-admin@postgresql.org" Content-Type: multipart/alternative; boundary=047d7bdcaa0e0b26a905195b262e X-Pg-Spam-Score: -1.7 (-) 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 --047d7bdcaa0e0b26a905195b262e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Everything has been corrected. The newly reloaded database is behaving much better. I did manage to get all my permission issues satisfied, although I have a followup question: For the two roles I wished to delete, I issued a revoke all privileges on each schema in the DB with a cascade option, but if I looked at table, relname in pg_class, I would still see that role as having select, update, and delete for the role's permission. Why wouldn't those be revoked when doing a revoke all privileges? Did I miss something? On Thu, Jun 25, 2015 at 10:33 AM, Jerry Sievers wrote: > Alvaro Herrera writes: > > > John Scalia wrote: > > > >> Hi all, > >> > >> I'm trying to build a new server from a copy of one of our live Dbs, > and I imported the schema from there and am now trying to get this new > server setup with the right ownership > >> and permissions. All the tables are/were owned by user A, and I've > changed most of them to user B (names changed to protect the innocent, > etc.,) However, some tables from the > >> pg_dump I used to grab the schema, do not show up using \d nor can I > see them in pg_class. I only found them when I tried to drop user A and > psql complained. They appear to be in a > >> different schema and I could change them one at a time, but there are > more than 2200 of these. For the tables I've already changed, I just > performed an update on pg_class where > >> relowner =3D numeric ID of user A to set that to the numeric ID of use= r B. > > > > You could try the REASSIGN OWNED BY command. > > > > Doing manual updates of relowner might not be the greatest idea ever; i= f > > any of these tables have grants, the representation of the grantor migh= t > > be borked after that. > > And I wonder about dependency records too? > > > > > -- > > =C3=81lvaro Herrera http://www.2ndQuadrant.com/ > > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services > > -- > Jerry Sievers > Postgres DBA/Development Consulting > e: postgres.consulting@comcast.net > p: 312.241.7800 > --047d7bdcaa0e0b26a905195b262e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Everything has been corrected. The newly reloaded database= is behaving much better. I did manage to get all my permission issues sati= sfied, although I have a followup question: For the two roles I wished to d= elete, I issued a revoke all privileges on each schema in the DB with a cas= cade option, but if I looked at table, relname in pg_class, I would still s= ee that role as having select, update, and delete for the role's permis= sion. Why wouldn't those be revoked when doing a revoke all privileges?= Did I miss something?

On Thu, Jun 25, 2015 at 10:33 AM, Jerry Sievers <gs= ievers19@comcast.net> wrote:
Alvaro Herrera <alvherre@2ndquadrant.com> writes:

> John Scalia wrote:
>
>> Hi all,
>>
>> I'm trying to build a new server from a copy of one of our liv= e Dbs, and I imported the schema from there and am now trying to get this n= ew server setup with the right ownership
>> and permissions. All the tables are/were owned by user A, and I= 9;ve changed most of them to user B (names changed to protect the innocent,= etc.,) However, some tables from the
>> pg_dump I used to grab the schema, do not show up using \d nor can= I see them in pg_class. I only found them when I tried to drop user A and = psql complained. They appear to be in a
>> different schema and I could change them one at a time, but there = are more than 2200 of these. For the tables I've already changed, I jus= t performed an update on pg_class where
>> relowner =3D numeric ID of user A to set that to the numeric ID of= user B.
>
> You could try the REASSIGN OWNED BY command.
>
> Doing manual updates of relowner might not be the greatest idea ever; = if
> any of these tables have grants, the representation of the grantor mig= ht
> be borked after that.

And I wonder about dependency records too?

>
> --
> =C3=81lvaro Herrera=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Servi= ces

--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres.consulting@c= omcast.net
p: 312.241.7800

--047d7bdcaa0e0b26a905195b262e--