仍然可以读取[Postgres]中的锁定行吗? [英] Can a locked row [in Postgres] still be read from?

查看:77
本文介绍了仍然可以读取[Postgres]中的锁定行吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我SELECT... FOR UPDATE事务中的一行,显然会阻止该行被写入,但是否也不允许读取?我希望仍能从该行中读取内容,因此,如果答案是肯定的,您可以提供解决方案吗?

If I SELECT... FOR UPDATE a row in a transaction, it will obviously block the row from being written to, but will it disallow reads as well? I'd prefer to still be able to read from the row, so if the answer is yes, can you provide a solution to work this?

推荐答案

您可以很好地阅读.有一些锁定模式可以防止读取,但这不是其中之一.

You can read just fine. There are lock modes that prevent reading but this isn't one of them.

http://www.postgresql.org/docs/current/static/explicit-locking .html

这篇关于仍然可以读取[Postgres]中的锁定行吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆