Re: Trying to change the owner of some tables

From: John Scalia <jayknowsunix(at)gmail(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(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 14:21:26
Message-ID: CABzCKRBeQJEZUGctkPvPJYd8woU96B-Bd+G2jPH=N_sJrcrhHg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Good thought Guillaume, but the only Dbs on this cluster are:

The one I'm working in
postgres
template0
template1

and that's it. Thinking these errant tables might have got created in the
postgres db, I did a \c postgres, then did \d in there. It came back with
no relations found.

On Thu, Jun 25, 2015 at 1:17 AM, Guillaume Lelarge <guillaume(at)lelarge(dot)info>
wrote:

>
>
> 2015-06-25 5:42 GMT+02:00 John Scalia <jayknowsunix(at)gmail(dot)com>:
>
>> Thanks guys, I was not aware of that command, but it did NOT succeed in
>> changing these strangely missing tables. The tables appear, when I try to
>> drop the old owner as:
>>
>> second_schema.partition_table_name_one;
>>
>> then two, three, etc., I've only been successful using
>>
>> alter table second_schema.partition_table_name_one owner to userB;
>>
>> But I'd rather not do that for 2000+ entries.
>>
>>
> The only reason that would explain why you can't see them with \d and in
> pg_class is that they are on another database. Same cluster but another
> database. You should connect to the other databases and use REASSIGN OWNED
> in each of them.
>
>
>>
>> On 6/24/2015 8:01 PM, David G. Johnston wrote:
>>
>> On Wed, Jun 24, 2015 at 10:44 PM, John Scalia <jayknowsunix(at)gmail(dot)com>
>> 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.
>>>
>>> Now, this is a 9.2 server on CentOS, but I've not seen this behavior
>>> anywhere before. Where else should I see these? The only success I've had
>>> is \d+ new_schema.* and that doesn't
>>> help me change them.
>>>
>>
>> ​ Possibly this...
>>
>> http://www.postgresql.org/docs/9.4/static/sql-reassign-owned.html
>> ​
>> David J.
>>
>>
>>
>
>
> --
> Guillaume.
> http://blog.guillaume.lelarge.info
> http://www.dalibo.com
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message naveen kumar 2015-06-25 14:23:11 Re: PostgreSQL Dump based backup using pipe
Previous Message Tom Lane 2015-06-25 13:45:38 Re: Trying to change the owner of some tables