Re: Move all elements toward another schema?

Поиск
Список
Период
Сортировка
От Marcos Pegoraro
Тема Re: Move all elements toward another schema?
Дата
Msg-id CAB-JLwYCoLxm-Gxja+LQ8e4yD2JZAFupfditL8FtMHrLbmZ_2Q@mail.gmail.com
обсуждение исходный текст
Ответ на Move all elements toward another schema?  (celati Laurent <laurent.celati@gmail.com>)
Список pgsql-general
As far as i know, this piece of code would move the data. But how to also move indexes, constraints, primary key?

create schema if not exists a;
create schema if not exists b;
create table a.a(id integer not null constraint pk_a primary key, name text);
create index idx_a_name on a.a(name);
alter table a.a set schema b;

select relnamespace::regnamespace, relname from pg_class where relname in ('a','pk_a','idx_a_name');
 relnamespace |  relname  
--------------+------------
 b            | a
 b            | idx_a_name
 b            | pk_a
(3 rows)
 

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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: Move all elements toward another schema?
Следующее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: Quit currently running query