Re: Get details of user locking a record?

Поиск
Список
Период
Сортировка
От Tony Day
Тема Re: Get details of user locking a record?
Дата
Msg-id AANLkTilOzJhR1qcrS7XNFnMdOvSyroEIbPrvHKqbtjjS@mail.gmail.com
обсуждение исходный текст
Ответ на Get details of user locking a record?  (Rob Northcott <Rob@teamsystems.co.uk>)
Ответы Re: Get details of user locking a record?  (Rob Northcott <Rob@teamsystems.co.uk>)
Список pgsql-novice
Hi Rob

Have a look at http://wiki.postgresql.org/wiki/Lock_Monitoring

It might be the sort of thing that you are looking for.

Regards, Tony


On Thu, May 13, 2010 at 5:50 AM, Rob Northcott <Rob@teamsystems.co.uk> wrote:

Hello list,

 

I'm pretty new to SQL servers, so this may be a silly question, but here goes anyway…

 

When a user tries to edit a record (SELECT * FROM mytable WHERE key = 'mykey' FOR UPDATE NOWAIT)  and it is locked by another user, I can trap the error and tell the user it is locked.  No problems there.  But is it possible to find out what other user (name or ip address?) is doing the locking?  I've done lots of web searching and it seems like it's considered a bad idea to lock records in database applications - but I don't want my users to spend ages editing, say, a customer's address or notes, only to be told they can't save the changes because somebody else has edited it in the meantime.

 

Is there an easy way (or any way for that matter) to find out who owns the lock on a specific record or a table?

 

Rob Northcott

Programmer, Team Systems Ltd.

 



--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice


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

Предыдущее
От: Rob Northcott
Дата:
Сообщение: Get details of user locking a record?
Следующее
От: Mladen Gogala
Дата:
Сообщение: Re: Interrupt