Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 39EA79F9ECF for ; Tue, 7 Nov 2006 01:47:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 54821-08 for ; Tue, 7 Nov 2006 01:47:29 -0400 (AST) X-Greylist: delayed 05:02:03.666859 by SQLgrey- Received: from faams.net (mail.faams.net [66.15.246.161]) by postgresql.org (Postfix) with ESMTP id B836C9F98F7 for ; Tue, 7 Nov 2006 01:47:28 -0400 (AST) Received: from [192.168.12.254] (dhcpd254.faams.net [192.168.12.254]) by faams.net (8.12.11/8.12.11) with ESMTP id kA75nkoE018283; Tue, 7 Nov 2006 00:49:50 -0500 Message-ID: <45501DE3.9050500@faams.net> Date: Tue, 07 Nov 2006 00:47:15 -0500 From: Herbie McDuck User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: Charley Tiggs CC: pgsql-php@postgresql.org Subject: Re: PostgreSQL locking from PHP scripts References: <20061026181147.50048.qmail@web51309.mail.yahoo.com> <200611061105.29055@hal.medialogik.com> <454FD71E.6070807@faams.net> <454FE7C7.2030102@tiggs.net> In-Reply-To: <454FE7C7.2030102@tiggs.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/15 X-Sequence-Number: 3633 Charley Tiggs wrote: > Herbie McDuck wrote: >>> Also, web connections are stateless and there is no way to even know >>> what web server process or database connection you'll be getting on >>> subsequent page views. >> So is PHP and 'ANY' database a useless adventure when it goes to >> developing a robust business and accounting package? > > Not at all. It just means that you'll have to create your own "state" > logic using sessions. For instance, create a column within the > necessary table that you can check to see whether or not some other > process/user is using the record in question and then build the > necessary logic around that to enable/disable access to the records. > > This is something that isn't specific to PHP. You'll encounter the > same issues with any other middleware language that uses a web browser > as it's primary means of interaction. HTTP just doesn't keep track of > the state of your application. It's up to you as the developer to > handle that. > > Charley > > ---------------------------(end of broadcast)--------------------------- > TIP 7: You can help support the PostgreSQL project by donating at > > http://www.postgresql.org/about/donate > > Hmmm..Yes I can see two columns in a record. The 'WHO' and some pending transaction ID that the calling session that locked the record knows about so that the update session can find the relevant and specific record to transact with. As mentioned, I've done something similar in another language. When you have ten people trying to sell low sulfur diesel fuel at the same moment in time, record contention can become dicey at best. --Hal.