Re: Moving a table to a different schema

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Reece Hart <rkh(at)gene(dot)COM>
Cc: jim(at)nasby(dot)net, pgsql-general(at)postgresql(dot)org
Subject: Re: Moving a table to a different schema
Date: 2003-05-30 23:17:32
Message-ID: 15829.1054336652@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Reece Hart <rkh(at)gene(dot)COM> writes:
>> Is there a command to move an existing table to a different schema?

> WARNING: The following works for me, but there might be other
> ramifications that I'm not aware of.

> admin(at)csb-dev=# update pg_class set relnamespace=2200 where
> relname='locus';

You would also need to update the namespace links for the associated
rowtype and for any indexes and constraints on the table. At least if
you wanted things to be clean. I am not sure whether anything critical
depends on these objects being in the same namespace as their parent
table, but certainly the system is not designed to cope with them not
being there.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message valerian 2003-05-31 00:36:54 Re: CURRENT_DATE and CURRENT_TIME return incorrect values
Previous Message Mark Kirkwood 2003-05-30 23:02:03 Re: Elog