Re: auto-reconnect: temp schemas, sequences, transactions - Mailing list pgsql-general

From Tom Lane
Subject Re: auto-reconnect: temp schemas, sequences, transactions
Date
Msg-id 23133.1304350346@sss.pgh.pa.us
Whole thread Raw
In response to Re: auto-reconnect: temp schemas, sequences, transactions  (Marek Więckowski <wieckom@foxi.nl>)
Responses Re: auto-reconnect: temp schemas, sequences, transactions  (Marek Więckowski <wieckom@foxi.nl>)
List pgsql-general
Marek =?utf-8?q?Wi=C4=99ckowski?= <wieckom@foxi.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

pgsql-general by date:

Previous
From: Marek Więckowski
Date:
Subject: Re: auto-reconnect: temp schemas, sequences, transactions
Next
From: jgoulet
Date:
Subject: Re: pipe line error (psql command)