Re: ALTER TABLE ... REPLACE WITH

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: ALTER TABLE ... REPLACE WITH
Дата
Msg-id 1292355671.2737.4600.camel@ebony
обсуждение исходный текст
Ответ на Re: ALTER TABLE ... REPLACE WITH  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Список pgsql-hackers
On Tue, 2010-12-14 at 21:35 +0200, Heikki Linnakangas wrote:
> On 14.12.2010 20:27, Simon Riggs wrote:
> > There are various applications where we want to completely replace the
> > contents of a table with new/re-calculated data.
> >
> > It seems fairly obvious to be able to do this like...
> > 1. Prepare new data into "new_table" and build indexes
> > 2. Swap old for new
> > BEGIN;
> > DROP TABLE "old_table";
> > ALTER TABLE "new_table" RENAME to "old_table";
> > COMMIT;
> >
> > Step (2) works, but any people queuing to access the table will see
> >    ERROR:  could not open relation with OID xxxxx
> 
> Could we make that work without error?

Possibly, and good thinking, but its effectively the same patch, just
syntax free since we still need to do lots of checking to avoid swapping
oranges with lemons.

I prefer explicit syntax because its easier to be certain that you've
got it right.

-- Simon Riggs           http://www.2ndQuadrant.com/books/PostgreSQL Development, 24x7 Support, Training and Services



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

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: pg_execute_from_file, patch v10
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: ALTER TABLE ... REPLACE WITH