Re: Moving tables between schemas - Mailing list pgsql-general

From Shridhar Daithankar
Subject Re: Moving tables between schemas
Date
Msg-id 200407301618.13632.shridhar@frodo.hserus.net
Whole thread Raw
In response to Re: Moving tables between schemas  (John Sidney-Woollett <johnsw@wardbrook.com>)
List pgsql-general
On Friday 30 Jul 2004 3:49 pm, John Sidney-Woollett wrote:
> You may be able to play around with the system catalogs, but I don't
> know anything about that...
>
> An easy method of moving the tables are
>
> create table mynewschema1.table1 as select * from public.table1;
> drop public.table1;
>
> create table mynewschema2.table2as select * from public.table2;
> drop public.table2;

One can also create a table before hand using 'create table like' and then
inserting rows. This has advantage of preserving any constraints in original
table.

But this does not take care of indexes AFAIK.

 Shridhar

pgsql-general by date:

Previous
From: John Sidney-Woollett
Date:
Subject: Re: Moving tables between schemas
Next
From: "Jason Tesser"
Date:
Subject: Re: Wal logs