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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marek Więckowski <wieckom(at)foxi(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: auto-reconnect: temp schemas, sequences, transactions
Date: 2011-05-02 15:32:26
Message-ID: 23133.1304350346@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marek =?utf-8?q?Wi=C4=99ckowski?= <wieckom(at)foxi(dot)nl> writes:
> 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...

Well, there will be no memory on the server side of any uncompleted
queries. If the client-side logic tries to re-issue these queries
after re-connecting, it would be up to that logic to be careful about
what to reissue or not. Possibly this is a question for the author
of your client library.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message jgoulet 2011-05-02 16:34:23 Re: pipe line error (psql command)
Previous Message Marek Więckowski 2011-05-02 15:17:11 Re: auto-reconnect: temp schemas, sequences, transactions