Search Postgresql Archives

Re: Move all elements toward another schema?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux