ALTER TABLE OWNER: change indexes

From: Neil Conway <nconway(at)klamath(dot)dyndns(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Subject: ALTER TABLE OWNER: change indexes
Date: 2002-02-24 21:13:30
Message-ID: 1014585210.7682.73.camel@jiro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi all,

Currently, ALTER TABLE OWNER only changes the ownership of a table; it
does not change the ownership of any of its 'dependants' (e.g. indexes,
sequences, etc). This patch modifies ALTER TABLE OWNER to change the
ownership of any of a table's indexes to match the new owner of the
table.

I didn't change sequence ownership, since a sequence could be used by
multiple tables. Bruce: can you add a note to the TODO -- it currently
has an item regarding dropping a table's serial sequences along with the
table. When/if this behavior is implemented, the same change should be
applied to ALTER TABLE OWNER.

I wasn't sure if ALTER TABLE OWNER should notify the user that the
ownership of some indexes are also being changed; this patch follows the
behavior of DROP TABLE, which is to be silent.

Also, I needed some utility code to find the name of a relation, given
its OID. I find a suitable utility function in
src/backend/utils/adt/ruleutils.c -- however, it's a static function. I
couldn't find a good place in the tree to stick this utility function,
so I just copy-and-pasted the code I needed. If someone would like to
suggest somewhere where this code should go, speak up and I'll happily
remove the duplicated code.

Comments and criticism are welcome.

Cheers,

Neil

--
Neil Conway <neilconway(at)rogers(dot)com>
PGP Key ID: DB3C29FC

Attachment Content-Type Size
alter_index_owner.patch text/x-patch 3.0 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2002-02-24 21:22:58 oid2name cleanup
Previous Message Tom Lane 2002-02-24 20:23:54 Re: [HACKERS] Updated TODO item