>
> 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)

Reply via email to