Re: Trying to change the owner of some tables - Mailing list pgsql-admin

From Alvaro Herrera
Subject Re: Trying to change the owner of some tables
Date
Msg-id 20150625030026.GI3289@postgresql.org
Whole thread Raw
In response to Trying to change the owner of some tables  (John Scalia <jayknowsunix@gmail.com>)
Responses Re: Trying to change the owner of some tables  (Jerry Sievers <gsievers19@comcast.net>)
List pgsql-admin
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
tryingto 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
protectthe 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
triedto 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
alreadychanged, 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.

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


pgsql-admin by date:

Previous
From: John Scalia
Date:
Subject: Trying to change the owner of some tables
Next
From: "David G. Johnston"
Date:
Subject: Re: Trying to change the owner of some tables