[英]sequence nextval in read-only transactions- postgresql 9
i recently upgraded to postgresql9 from postgresql8.我最近从 postgresql8 升级到 postgresql9。 i have a method marked as @Transactional(readonly=true) and call nextval on the sequence.
我有一个标记为@Transactional(readonly=true) 的方法并在序列上调用nextval。 it worked fine in Postgres8 but it fails in Postgres9.
它在 Postgres8 中运行良好,但在 Postgres9 中失败。 I looked around but nothing concrete.
我环顾四周,但没有什么具体的。 did anyone encounter this problem.
有没有人遇到过这个问题。 i could write a interceptor to change the transaction to write, but was wondering whether this is now a new restriction and can it be changed through some configuration setting on postgresq9
我可以编写一个拦截器来更改要写入的事务,但想知道这现在是否是一个新限制,并且可以通过 postgresq9 上的一些配置设置来更改它
On 05/11/2011 02:29 PM, Dae-man Yang wrote:
2011 年 5 月 11 日下午 2:29,Dae-man Yang 写道:
I upgrade postgresql from 8.4.2 to 9.0.4.
我将 postgresql 从 8.4.2 升级到 9.0.4。 But I have one problem.
但我有一个问题。 The Error message 'cannot execute nextval() in a read-only transaction'
错误消息“无法在只读事务中执行 nextval()”
Please help me.
请帮我。
nextval() modifies a sequence, so you shouldn't be doing it in a read-only transaction.
nextval() 修改一个序列,所以你不应该在只读事务中这样做。 Pg 9.0.4 enforces this, but it was still a bug in whatever was trying to use nextval() in a read-only transaction before 9.0, Pg just didn't notice and warn you.
Pg 9.0.4 强制执行此操作,但它仍然是在 9.0 之前尝试在只读事务中使用 nextval() 的任何错误,Pg 只是没有注意到并警告您。
-- Craig Ringer
——克雷格·林格
http://archives.postgresql.org/pgsql-general/2011-05/msg00373.php http://archives.postgresql.org/pgsql-general/2011-05/msg00373.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.