user_write_lock_oid questions

Started by Marian Naghenover 20 years ago2 messagesgeneral
Jump to latest
#1Marian Naghen
naghen@ratb.ro

I'm new to PostgreSQL and I'm a litle confused.

I have 2 questions about using user_write_lock functions:

1. if a user set a write lock and then, for some reason (bad connections, app chashes, etc), disconect from server without releasing, what happened with the lock ? It will be still
holding ?

2. there is a way to set/obtain informations about the user who sets a lock ?

thanks.

#2Qingqing Zhou
zhouqq@cs.toronto.edu
In reply to: Marian Naghen (#1)
Re: user_write_lock_oid questions

""Marian Naghen"" <naghen@ratb.ro> wrote

1. if a user set a write lock and then, for some reason (bad
connections, app chashes, etc), disconect from server without releasing,
what happened with the lock ? It will be still holding ?

When the connection is lost, server will release all its resources,
including locks.

2. there is a way to set/obtain informations about the user who sets a
lock ?

Check out pg_stat_get_backend_userid(integer backendid) function.

Regards,
Qingqing