[postgis-devel] Concurrent Modification and Feature Locking

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon Jul 24 04:52:18 PDT 2006


On Fri, 2006-07-21 at 09:24 -0700, Cory Horner wrote:

(cut)

> Thanks guys!  Yesterday I implemented my first attempt at row locking 
> using SELECT ... FOR UPDATE, but was surprised to discover that this 
> query also blocked, even with the query timeout value set.  This led to 
> another attempt using a timer thread (did not work well, as postgres 
> does not take kindly to dropped connections).  Fortunately Paul has 
> discovered NOWAIT which will likely solve all our woes.
> 
> Our current workflow is:
> 
> SELECT ...  FOR UPDATE NOWAIT
> - on success UPDATE ...
> - on failure query pg_locks to generate an intelligent exception, citing 
> who has the row locked, etc
> 
> Thanks again,
> Cory.


Hi Cory,

That should work, but I think that the NOWAIT option was new in 8.1 and
so this will not work on older versions of PostgreSQL - would this
matter for your application?


Kind regards,

Mark.






More information about the postgis-devel mailing list