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@rogers.com>
PGP Key ID: DB3C29FC