Re: Change onership of database and all tables? (fwd)

From: "John Sidney-Woollett" <johnsw(at)wardbrook(dot)com>
To: "Russ Schneider" <russ(at)sugapablo(dot)com>
Cc: "pgsql-general" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Change onership of database and all tables? (fwd)
Date: 2003-12-29 08:30:49
Message-ID: 4520.192.168.0.64.1072686649.squirrel@mercury.wardbrook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If you use the following query:

select 'grant all on '||schemaname||'.'||tablename||' to NEWOWNER;'
from pg_tables
where schemaname in ('schema1', 'schema2', 'schema3', 'schemaN');

You will generate the appropriate scripts to grant ALL rights on tables
belonging to 'schema1', 'schema2', 'schema3', 'schemaN' to the user
NEWUSER.

Copy the resulting rows, and run them against the database. Simple, and
effective.

Hope that helps.

John Sidney-Woollett

Russ Schneider said:
>
> On Sun, 28 Dec 2003, Russ Schneider wrote:
>
>>
>> In 7.2, how would you change ownership of a database and all its tables
>> and sequences?
>>
>> Right now everything is owned by postgres and I want to change ownership
>> to a regualar user.
>
> Or if no one can answer the above question, what about a way to grant
> permissions on more than one table at a time? Like GRANT ALL PRIVILEGES
> ON [ALL TABLES] TO [USER]?
>
> --
> [ Russ Schneider (a.k.a. Sugapablo) ]
> [ http://www.sugapablo.com <--music ]
> [ http://www.sugapablo.net <--personal ]
> [ sugapablo(at)12jabber(dot)com <--jabber IM ]
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gaetano Mendola 2003-12-29 08:45:15 Re: Is my MySQL Gaining ?
Previous Message Mark Kirkwood 2003-12-29 08:14:07 Re: Firebird and PostgreSQL at the DB Corral.