Re: Renaming tables to other schemas - Mailing list pgsql-hackers

From Rod Taylor
Subject Re: Renaming tables to other schemas
Date
Msg-id 1077291855.25444.263.camel@jester
Whole thread Raw
In response to Re: Renaming tables to other schemas  (Robert Treat <xzilla@users.sourceforge.net>)
List pgsql-hackers
> Rod, can you lay out some psdueo code / logic involved in the process?  I'm 
> guessing you lock the entry in pg_class, you up dependent objects, lock them, 
> update them all... is there more to it?

It was one an offline database at the time with only a single user -- so
locking wasn't a concern at the time.

To change the namespace of a table, update the namespace ID for:

pg_class -> of table
pg_type -> of table
pg_class -> index(es) on table
pg_type -> of indexes on table
pg_constraint -> all constraints on table
pg_depend -> dependencies of above objects on the namespace

We didn't have inheritance or the more exotic items, but I seem to
recall the views continued to work as expected with no changes.

Dump and restore gave us what we expected, and the database functions as
expected but that doesn't necessarily mean the above covers all items.




pgsql-hackers by date:

Previous
From: Robert Treat
Date:
Subject: Re: Renaming tables to other schemas
Next
From: Robert Treat
Date:
Subject: Re: [Resend: Domains and function]