Re: possible bug in DB/pgsql.php

From: Date: Mon, 19 Feb 2001 15:05:08 +0000
Subject: Re: possible bug in DB/pgsql.php
References: 1  Groups: php.pear 
Request: Send a blank email to php-pear+get-1381@lists.php.net to get a copy of this message
On 19 Feb 2001, at 13:27, Stig S. Bakken wrote: > fabrizio.ermini@sysdat.it wrote: > > > > Hmm, maybe I'm straying too far...I'm not too content of my own > > suggestions. Your turn... > > I've implemented your suggestion now and added a transaction test for > pgsql as well. Could you give it a shot and see if it solves your > problem? > Funny to see that you've liked my suggestions more than myself :-) I'll sure do it this afternoon, after "regular" work time :-)... > One thing I noticed is that postgres shows the changes done inside a > transaction to other transactions before it is committed. With other > databases the changes are not visible until you do a commit. This one > is a bit hard to emulate though. > This has to do with the particular level of isolation the DB implements. PGsql works at 2 possible isolation levels: read committed, and serializable isolation (you can switch any time with a SET command). The first mode, that's the default one (and very few users change it IMHO) allows unrepeatable reads, that is, in short: querys inside a transaction can read uncommitted data from other transactions. In the second mode, this is not possible (updates are not shown to other transactions until committed). I do not see why you could wish to "emulate" this, however; I think it's wiser to let each backend handle transaction its own way. I would leave to the programmer the task to decide if he needs read committed or serializable isolation level. If you wish to achieve the maximum compatibility between various backends, guess the smarter thing it's relying on SQL92 standards. They consider, indeed, the serializable level as the default. Since it's switchable at runtime, PG could be made to run at that level "by default" under PEAR simply by issuing the "SET LEVEL..." in the constructor; in this case, for the user that wish to use the "relaxed" level, there is still the possibility to switch back using the reversed command. We'd just to be sure that PG users migrating to PEAR are aware of this "reversed default", writing it at capital letters in every piece of doc we can (not that there are much, but... :-)), or they could be a little confused! I'll continue later... bye! /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ Fabrizio Ermini Alternate E-mail: C.so Umberto, 7 faermini@tin.it loc. Meleto Valdarno Mail on GSM: (keep it short!) 52020 Cavriglia (AR) faermini@sms.tin.it

« previous php.pear (#1381) next »