Re: Moving a table to a different schema - Mailing list pgsql-general

From Tom Lane
Subject Re: Moving a table to a different schema
Date
Msg-id 15829.1054336652@sss.pgh.pa.us
Whole thread Raw
In response to Re: Moving a table to a different schema  (Reece Hart <rkh@gene.COM>)
List pgsql-general
Reece Hart <rkh@gene.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@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

pgsql-general by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: Elog
Next
From: valerian
Date:
Subject: Re: CURRENT_DATE and CURRENT_TIME return incorrect values