Re: Removing a schema

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Removing a schema
Дата
Msg-id 20601.1186495195@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Removing a schema  (Naz Gassiep <naz@mira.net>)
Список pgsql-general
Naz Gassiep <naz@mira.net> writes:
> I'm trying to remove a schema and move all the tables to another schema.
> I've manually run alter table on every table to move them, however all
> the foreign keys still reference the old schema,

What?  It works fine for me:

regression=# create schema s1;
CREATE SCHEMA
regression=# create table s1.t1(f1 int primary key);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "t1_pkey" for table "t1"
CREATE TABLE
regression=# create table s1.t2(f1 int references s1.t1);
CREATE TABLE
regression=# create schema s2;
CREATE SCHEMA
regression=# alter table s1.t1 set schema s2;
ALTER TABLE
regression=# \d s1.t2
        Table "s1.t2"
 Column |  Type   | Modifiers
--------+---------+-----------
 f1     | integer |
Foreign-key constraints:
    "t2_f1_fkey" FOREIGN KEY (f1) REFERENCES s2.t1(f1)


            regards, tom lane

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

Предыдущее
От: Ranieri Mazili
Дата:
Сообщение: Restricting columns by users
Следующее
От: Kenji Morishige
Дата:
Сообщение: Re: finding reusable ids