错误更新记录

问题描述:

我得到一个MySQL错误:错误更新记录

#UPDATE(ActiveRecord的:: StatementInvalid)“的Mysql ::错误:#HY000Got错误139从存储引擎:

当试图更新与长度的字符串记录文本字段1429个字符,如何追查问题的任何想法吗?

下面是堆栈跟踪。

from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:147:in `log' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:299:in `execute' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:167:in `update_sql' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:314:in `update_sql' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:49:in `update_without_query_dirty' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:19:in `update' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/base.rb:2481:in `update_without_lock' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/locking/optimistic.rb:70:in `update_without_dirty' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/dirty.rb:137:in `update_without_callbacks' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/callbacks.rb:234:in `update_without_timestamps' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/timestamp.rb:38:in `update' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/base.rb:2472:in `create_or_update_without_callbacks' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/callbacks.rb:207:in `create_or_update' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/base.rb:2200:in `save_without_validation' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/validations.rb:901:in `save_without_dirty' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/dirty.rb:75:in `save_without_transactions' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/transactions.rb:79:in `transaction' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/transactions.rb:98:in `transaction' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/transactions.rb:118:in `rollback_active_record_state!' 
from /var/www/releases/20081002155111/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save' 
+0

什么是你要更新列的类型? – mwilliams 2008-10-02 17:28:09

+0

是的,我有几个细节可能会帮助! – 2008-10-02 18:44:20

也许是这个错误:#1030 - Got error 139 from storage engine,但它会帮助,如果你想发布这应该错误消息后直接前来查询。

这似乎是一个非常奇怪的MySQL错误,其中,所述文本是被截断到256个字符(用于文本类型)和投掷上述错误是串是1000个字符或更多。修改表格列为文本再次修复问题,或者它只是修复它自我..我仍然不确定。

更新: 更改表类型当你说一个文本字段的MyISAM固定这个问题

,它是类型为VARCHAR,或TEXT的?

如果前者,那么你不能存储的字符串大于255个字符(可能少使用UTF-8开销)在该列。如果是后者,最好发布模式定义,以便人们可以进一步提供帮助。