Re: restore single table

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: restore single table
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C2031AB0A7@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на restore single table  ("Kevin Duffy" <KD@wrinvestments.com>)
Ответы Re: restore single table  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
Список pgsql-general
Kevin Duffy wrote:
> I need guidance on how move some changes that I have made to
> my production database.
>
> On my development database I made changes to a table called
> DEPT.  I added a column, added
>
> a couple of records and did some general data cleanup
>
>
>
> What I did not do was change any of the keys on existing
> records. The primary key of DEPT is a
>
> foreign key in several other tables.
>
>
>
> Here is my question:  Can I do a table restore on to the
> production database and expect these
>
> changes to be moved over?  Will the restore handle, via some
> magic, "suspend" the foreign key
>
> constraints and allow the new table structure to be created
> and then populated with new data.
>
>
>
> I have not changed the keys of existing records so that
> existing relationships should be restored.

A few thoughts:

Maybe you do not need to delete and recreate the table.
An ALTER TABLE statement can, for example, add a column to
an existing table.
That way you could leave the foreign key constraints in place
while you do the update.

If you cannot avoid dropping and recreating the table, you
could proceed like this: drop all foreign key constraints
to your table, recreate it and add the constraints again.

You should write an SQL script that does the necessary changes
and test it beforehand.

Lock out all database users while you perform substantial changes
to the database.

Yours,
Laurenz Albe

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

Предыдущее
От: 野村
Дата:
Сообщение: Re: javascript and postgres
Следующее
От: Abdul Rahman
Дата:
Сообщение: Oracle Functions to PostgreSQL