2008-10-02 130 views
0

我得到一個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

回答

0

這似乎是一個非常奇怪的MySQL錯誤,其中,所述文本是被截斷到256個字符(用於文本類型)和投擲上述錯誤是串是1000個字符或更多。修改表格列爲文本再次修復問題,或者它只是修復它自我..我仍然不確定。

更新: 更改表類型當你說一個文本字段的MyISAM固定這個問題

1

,它是類型爲VARCHAR,或TEXT的?

如果前者,那麼你不能存儲的字符串大於255個字符(可能少使用UTF-8開銷)在該列。如果是後者,最好發佈模式定義,以便人們可以進一步提供幫助。