Re: Proper Method for using LockAcquire

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Proper Method for using LockAcquire
Дата
Msg-id 20060713185305.GD14177@svana.org
обсуждение исходный текст
Ответ на Proper Method for using LockAcquire  (Chris Bowlby <excalibur@accesswave.ca>)
Список pgsql-hackers
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.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Proper Method for using LockAcquire
Следующее
От: "Marc G. Fournier"
Дата:
Сообщение: Re: Three weeks left until feature freeze