Re: php with postgres - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: php with postgres
Date
Msg-id 200307310435.h6V4ZLO03672@candle.pha.pa.us
Whole thread Raw
In response to php with postgres  (ivan <iv@psycho.pl>)
List pgsql-hackers
OK, I checked the URL's, and I am a little confused.  I don't understand
why the conditional transaction abort isn't in the same place as the
RESET ALL.  Seems they should be done at the same time, though there is
an advantage to doing the RESET ALL during connect, because if someone
changes the postgres.conf setting between the disconnect and the
connect, you would then see the new values, which seems correct.  

Is that what is happening?  If it is, this line is wrong:
    pg_result = PQexec(pgsql, "BEGIN;ROLLBACK;RESET ALL;");

because you have already rolled back the connection during the
disconnect.  This is the code for old servers.

---------------------------------------------------------------------------

Marcus B?rger wrote:
> Hello Bruce,
> 
> Thursday, July 24, 2003, 11:57:39 PM, you wrote:
> 
> BM> Jan Wieck wrote:
> >> Marcus B?rger wrote:
> >> > ATM i have a patch doing the following:
> >> > Connect:
> >> >  If PQprotocolVersion() is available and >= 3 PQparameterStatus() is available
> >> >  then i check the server version. Else i check the lib version (*).
> >> >  If the version to check is >= 7.2 ido one of the following:
> >> >  - If one of PQprotocolVersion() and PQtransactionStatus() is unavailable or
> >> >    protocol version < 3:
> >> >      "BEGIN;COMMIT;RESET ALL;"
> >> > 
> >> >  - If protocol version >= 3 and transaction status == PQTRANS_IDLE:
> >> >      "RESET ALL;"
> >> >  - If protocol version >= 3 and transaction status != PQTRANS_IDLE:
> >> >      "COMMIT;RESET ALL;"
> >> 
> >> Shouldn't that be
> >> 
> >>      ROLLBACK; RESET ALL;
> >> 
> >> and the other one "BEGIN; ROLLBACK; RESET ALL;" ?
> >> 
> >> I don't want to have the possibly partial transaction from a crashed PHP 
> >> script to be committed by default. At least it would be a significant 
> >> difference between persistent and non-persistent connections, because we 
> >> rollback if we loose the connection.
> 
> BM> Right, as I just emailed.  I wonder if we made the mistake of
> BM> recommending BEGIN;COMMIT; to the PHP folks a while back, or whether they
> BM> just did it themselves.
> 
> BM> I remember telling them they couldn't just do ROLLBACK because that
> BM> would fill the logs, but I am not sure how they got BEGIN;COMMIT;
> BM> rather than BEGIN;ROLLBACK.  It just shows we need better communication
> BM> between the communities.
> 
> 
> 
> Ok, i'd of course appreciate more eyes before my commit then (i need to become
> more familiar with the whole postgres source). I've put three files online:
> - the diff against current php haed
>   http://marcus-boerger.de/php/ext/pgsql/pgsql-persistent-20030725.diff.txt
> - the complete new file
>   http://marcus-boerger.de/php/ext/pgsql/pgsql.c
> - the parts relevant (request start/stop)
>   http://marcus-boerger.de/php/ext/pgsql/pgsql-request-start-stop.c
> 
>   
> Best regards,
>  Marcus                            mailto:marcus.boerger@post.rwth-aachen.de
> 
> 

--  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: Bruce Momjian
Date:
Subject: Re: php with postgres
Next
From: Bruce Momjian
Date:
Subject: Re: name of configure threading option