Lock record in the table
Lock record in the table
(OP)
Hi,
How can I lock record in the table in postgres. Means another person not even select the row which I m going to update the row in the table. I don't want to lock table.
Regards,
Tushar
How can I lock record in the table in postgres. Means another person not even select the row which I m going to update the row in the table. I don't want to lock table.
Regards,
Tushar
RE: Lock record in the table
You need a transaction to do that.
There is support for explicit locking too, but that is also related to transactions : "the lock is dropped as soon as the transaction ends".
Feherke.
http://rootshell.be/~feherke/
RE: Lock record in the table
Thanks for quick reply.
If I do explicit locking even another user can select the record but will not update. I want another user should not select the particular record which I have lock for update.
Please tell me how to do this.
Regards,
Tushar
RE: Lock record in the table
That is not possible exactly as you wish. "Row-level locks do not affect data querying". So you have to use access exclusive locking mode.
Feherke.
http://rootshell.be/~feherke/