Re:

Поиск
Список
Период
Сортировка
От Luca Ferrari
Тема Re:
Дата
Msg-id CAKoxK+4XZr8Xcen9v06Y=JmG1QxZw5nWSPYvJ5=WCvoGU6KUkQ@mail.gmail.com
обсуждение исходный текст
Ответ на  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Ответы Re:  (Vincenzo Romano <vincenzo.romano@notorand.it>)
Список pgsql-general
On Fri, Jul 12, 2013 at 1:23 PM, Vincenzo Romano
<vincenzo.romano@notorand.it> wrote:
> Hi all
> I'm making some experiments with table archiving and I'd like to
> "replace" a full table F with an empty one E.
> In order to do this I see only one way:
>
> ALTER TABLE F RENAME TO T;
> ALTER TABLE E RENAME TO F;
> ALTER TABLE T RENAME TO E; -- optional
>
> This implies there's a moment when the full table doesn't exist.
> Would a transaction enclosure ensure that the table F will be always
> available to all clients?


If I get it right using transaction boundaries around the DDL will
prevent clients to query the F table until the transaction ends, and
this is due to the locking of the alter table. In other words, a query
performed against the F table while the transaction is running will
simply locks without generating any error.

Hope this helps.
Luca


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

Предыдущее
От: Alexander Farber
Дата:
Сообщение: Re: Syntax error at or near “on”
Следующее
От: Vincenzo Romano
Дата:
Сообщение: Re: