Re: php with postgres - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: php with postgres
Date
Msg-id 200307222016.h6MKGrE20156@candle.pha.pa.us
Whole thread Raw
In response to php with postgres  (ivan <iv@psycho.pl>)
Responses Re: php with postgres  (marcus.boerger@t-online.de (Marcus Börger))
List pgsql-hackers
Marcus B?rger wrote:
> Yeah well it seems i gave a wrong impression what is actually happening now.
> We don't handle any transaction at the moment but starting with the second
> call to pg_pconnect on the same db we do RESET ALL. The following log is from
> a three connections, so you can see two RESET ALL.
> 
> DEBUG:  BackendStartup: forked pid=28253 socket=8
> LOG:  query: select getdatabaseencoding()
> LOG:  query: RESET ALL
> LOG:  query: RESET ALL
> LOG:  query: BEGIN;ROLLBACK;
> LOG:  unexpected EOF on client connection
> 
> However it may be very usefull to terminate any open transaction before
> reusing a persisten connection. Typically this happens when the same script
> runs again. But anyway using transactions together with persistent conenctions
> in a multithreaded environment isn't the best thing you could do. So our
> options are
> 1) tell the users to do 'auto commit mode'
> 2) nested transactions
> 3) locking
> 
> >From my perspective 2) and 3) are bad ideas for the web environment. In other
> words i guess we should leave it as is with transaction rollback only when the
> client terminates (e.g. the webserver stops).

I don't see why you wouldn't just do BEGIN;COMMIT;RESET ALL; when you
pass the connection to a new client.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Criteria for contrib/ versus gborg?
Next
From: Bruce Momjian
Date:
Subject: Re: PostgreSQL 7.3.3 and Intel C compiler