Re: [Fwd: Re: haven't forgotten about you...] - Mailing list pgsql-hackers

From Tim Perdue
Subject Re: [Fwd: Re: haven't forgotten about you...]
Date
Msg-id 39937D80.9E7B87E7@valinux.com
Whole thread Raw
In response to [Fwd: Re: haven't forgotten about you...]  (Tim Perdue <tperdue@valinux.com>)
Responses Re: [Fwd: Re: haven't forgotten about you...]
List pgsql-hackers
Ben Adida wrote:
> begin transaction
> select balance from accounts where account_id=2 for update
> 
> will select the balance and lock the row for account #2
> You can then perform some math on the balance, and do something like:
> 
> update accounts set balance= $new_balance where account_id=2
> end transaction
> 

Great - I assume end transaction is going to do a commit. If you don't
do an end transaction and you don't issue a rollback... I assume it
rolls back?

This is pretty slick - over the last month or so I've come up with about
8 different places where I really wish I had transactions/rollbacks on
SourceForge. Also running into lots of places where I really, really
wish I had fscking subselects...

Tim

-- 
Founder - PHPBuilder.com / Geocrawler.com
Lead Developer - SourceForge
VA Linux Systems
408-542-5723


pgsql-hackers by date:

Previous
From: Tim Perdue
Date:
Subject: [Fwd: Re: haven't forgotten about you...]
Next
From: Don Baccus
Date:
Subject: Re: [Fwd: Re: haven't forgotten about you...]