Re: Modifying table ownership

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Paul Laub <plaub(at)incyte(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Modifying table ownership
Date: 2001-12-28 05:08:59
Message-ID: 200112280508.fBS58x501719@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Dear all,
>
> When altering table ownership with
>
> ALTER TABLE table OWNER TO new owner
>
> is there any way to have PostgreSQL 7.1.3 (the version I use) recursively
> change
> ownership of all indexes, triggers, and metadata related to or implicitly
> created by
> the renamed table? If not, then what is the solution? What I do now is (1) drop
> indexes, (2) rename the table to table_old, (3) create a new table with desired
> owner, (4) insert into table select * from table_old, and finally (5) drop
> table table_old.
> There has got to be an easier way.

You can update pg_class directly to change ownership for those indexes.

Added to TODO:

o Have ALTER TABLE OWNER change all dependant objects like indexes

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Roland Roberts 2001-12-28 05:25:36 Re: How to access array elements via PL/pgSQL trigger?
Previous Message Tom Lane 2001-12-28 04:43:29 Re: How to access array elements via PL/pgSQL trigger?