Re: Moving tables between schemas

Поиск
Список
Период
Сортировка
От John Sidney-Woollett
Тема Re: Moving tables between schemas
Дата
Msg-id 410A20CB.5050107@wardbrook.com
обсуждение исходный текст
Ответ на Moving tables between schemas  ("m.e.bruche@lse.ac.uk" <m.e.bruche@lse.ac.uk>)
Ответы Re: Moving tables between schemas  ("m.e.bruche@lse.ac.uk" <m.e.bruche@lse.ac.uk>)
Re: Moving tables between schemas  (Shridhar Daithankar <shridhar@frodo.hserus.net>)
Список pgsql-general
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;

You may need to recreate any indexes that the tables used in the public
schema, and you may need to grant rights in order to allow your users to
access the tables...

Hope that helps

John Sidney-Woollett

create

m.e.bruche@lse.ac.uk wrote:
>
> Hi,
>
> In my database, I created a lot of tables before I found out about
> schemas. It's a mess!
>
> Suppose I want to get organised, and create a couple of schemas. How do
> I move existing tables into my newly created schemas?
>
> e.g.
>
> public.table1 -> mynewschema1.table1
> public.table2 -> mynewschema2.table2
>
> ?
>
> Thanks.
>
> Max
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

В списке pgsql-general по дате отправления:

Предыдущее
От: Shridhar Daithankar
Дата:
Сообщение: Re: Moving tables between schemas
Следующее
От: "m.e.bruche@lse.ac.uk"
Дата:
Сообщение: Re: Moving tables between schemas