On Thu, Jul 13, 2006 at 03:01:31PM -0300, Chris Bowlby wrote:
> Hi All,
>
> I've been working on a small module that I will be pluging into my
> local PostreSQL 8.x database and am in need of doing some table locking.
> At this time, I've used various other examples to no avail and was
> wondering what the proper method for aquiring a table lock within the
> module would be?
Firstly, why? Most operations in PostgreSQL acquire the appropriate
locks for you, so you don't need to do it yourself. Explicit locking
opens you up to deadlocks.
Secondly, what's wrong with LockRelation(rel, lockmode)? I grabbed that
from relation_open in access/heap/heapam.c.
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.