Re: auto-reconnect: temp schemas, sequences, transactions

Поиск
Список
Период
Сортировка
От Marek Więckowski
Тема Re: auto-reconnect: temp schemas, sequences, transactions
Дата
Msg-id 201105021717.12058.wieckom@foxi.nl
обсуждение исходный текст
Ответ на Re: auto-reconnect: temp schemas, sequences, transactions  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: auto-reconnect: temp schemas, sequences, transactions
Список pgsql-general
Hi,

On Monday 02 May 2011 16:43:54 Tom Lane wrote:
> Marek Wieckowski <wieckom@foxi.nl> writes:
> > If I understand correctly, Tom's reply in:
> > http://archives.postgresql.org/pgsql-general/2007-06/msg01668.php
> > suggests that temp schemas are kept when a session gets disconnected
> > because connections get automatically re-established with the same
> > backend id, and if this succeeds the old temp tables get picked up by the
> > new connection as if there was no disconnection at all.
>
> Uh, no, surely not.  The schema itself is re-used if it exists, but all
> the contained tables get flushed by the new session (if for some reason
> the old session failed to do that, as it would in case of a crash).

Clear. Thanks for your answer.


But what happens with a db transaction upon disconnect? If I have (say, in c++
code or a script):

begin;
query1;
query2;
query3;
query4;
query5;
commit;

(with possibly some extra c++ or script code in between queries), and
somewhere at the time when query2 is being executed some other backend
crashes; session gets disconnected and automatically connected: what would
happen to next queries which would be executed by the external code (query3, 4
and so on)? They would not be executed outside of db transaction, wouldn't
they? I would hope that they all keep failing up until next commit/rollback or
something similar...

Best,
~Marek


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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: pervasiveness of surrogate (also called synthetic) keys
Следующее
От: Tom Lane
Дата:
Сообщение: Re: auto-reconnect: temp schemas, sequences, transactions