I have a database that I must assign ownership to a new role. I want
this new role to own the entire database and all of it's tables,
views, triggers, & all. When I run the ALTER DATABASE command below,
it only changes the database role but the tables are all still owned
by the previous role. Is there a way I can assign the 27 tables to
Lauren rather than doing the command one by one for each table?
postgres=# ALTER DATABASE iamunix OWNER TO lauren;
ALTER DATABASE
postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype
|
Access privileges
-----------+----------+----------+-------------+-------------+----------------------- iamunix | lauren | UTF8 |
en_US.UTF-8| en_US.UTF-8 |
All tables still owned by Carlos:
iamunix=# \d List of relationsSchema | Name | Type | Owner
--------+------------------+----------+--------public | dept | table | carlospublic | dept_id_seq |
sequence| carlospublic | employees | table | carlospublic | employees_id_seq | sequence | carlospublic |
manager_lookup | view | carlospublic | managers | table | carlospublic | managers_id_seq | sequence |
carlos
**PS**
I did do a Google search for "PostgreSQL 9.1 change ownership
recursively" but either couldn't find what I was looking for or
missed it.