Re: Trying to change the owner of some tables

From: Jerry Sievers <gsievers19(at)comcast(dot)net>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: John Scalia <jayknowsunix(at)gmail(dot)com>, "pgsql-admin\(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Trying to change the owner of some tables
Date: 2015-06-25 17:33:14
Message-ID: 86r3ozhew5.fsf@jerry.enova.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> 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 = 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 might
> be borked after that.

And I wonder about dependency records too?

>
> --
> Álvaro Herrera http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

--
Jerry Sievers
Postgres DBA/Development Consulting
e: postgres(dot)consulting(at)comcast(dot)net
p: 312.241.7800

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message John Scalia 2015-06-25 17:42:15 Re: Trying to change the owner of some tables
Previous Message John Scalia 2015-06-25 15:57:37 Re: database must be vacuumed with <N> transactions