Re: ALTER TABLE ... REPLACE WITH

Поиск
Список
Период
Сортировка
Искать
От
Csaba Nagy
Тема
Re: ALTER TABLE ... REPLACE WITH
Дата
Msg-id
1292411839.22635.58.camel@clnt-sysecm-cnagy
Ответ на
Список
Дерево обсуждения
Re: ALTER TABLE ... REPLACE WITH "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: ALTER TABLE ... REPLACE WITH Robert Haas <robertmhaas@gmail.com>
On Wed, 2010-12-15 at 10:39 +0000, Simon Riggs wrote:
> Perhaps a more useful definition would be
> 
> EXCHANGE TABLE target WITH source;
> 
> which just swaps the heap and indexes of each table.
> You can then use TRUNCATE if you want to actually destroy data.

Yes please, that's exactly what I would have needed in many occasions.

But one problem would be when the replaced table is the _parent_ for a
foreign key relationship. I don't think you can have that constraint
pre-verified on the replacement table and simply replacing the content
could leave the child relations with orphans.

Cheers,
Csaba.



В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
Сообщение: Re: Default mode for shutdown
От: Csaba Nagy
Дата:
FAQ