Change owner for all tables in a database in one batch

From: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Change owner for all tables in a database in one batch
Date: 2013-03-06 12:30:44
Message-ID: CAADeyWhbnMGG6Gp3cywXCx9DxOY7TJPfAUA-0iim-ocB4VL7Kg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

by accident I have wrong owner for all tables in my 8.4.13 database:

bukvy=> select * from pg_tables where tableowner = 'skat';
schemaname | tablename | tableowner |
tablespace | hasindexes | hasrules | hastriggers
------------+------------------------------------+------------+------------+------------+----------+-------------
public | drupal_actions | skat |
| t | f | f
public | drupal_batch | skat |
| t | f | f
public | drupal_authmap | skat |
| t | f | f
....
public | drupal_watchdog | skat |
| t | f | f
(83 rows)

But they actually should have the user "bukvy" as the owner.

Is there maybe a one-liner for changing the ownership in 1 batch
or should I execute "alter table .... set owner to bukvy" one by one?

Thank you
Alex

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2013-03-06 13:19:48 Re: Change owner for all tables in a database in one batch
Previous Message Glyn Astill 2013-03-06 10:49:29 Re: Why does slony use a cursor? Anyone know?