Re: Renaming tables to other schemas

From: Rod Taylor <pg(at)rbt(dot)ca>
To: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
Cc: Neil Conway <neilc(at)samurai(dot)com>, ziga(at)ljudmila(dot)org, PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>, Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Subject: Re: Renaming tables to other schemas
Date: 2004-02-20 15:44:16
Message-ID: 1077291855.25444.263.camel@jester
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2004-02-20 16:10:30 Re: [HACKERS] [Resend: Domains and function]
Previous Message Robert Treat 2004-02-20 15:13:00 Re: Renaming tables to other schemas