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