views:

1459

answers:

1

I am using Ruby 1.8.6 and rails 2.1.1 (I have tested rails 2.2.2 as well). I have been using Sqlite3 and I recently migrated to Postgresql 8.2.6 for production use. Now this error shows up. The interesting thing is that when I copy the insert statment and use psql to directly insert it into postgres it works fine. I guess the problem is somewhere on the rails level. But, I have no idea what it is. So if anybody knows what the problem is or how to fix it please let me know.

RuntimeError: ERROR C22003 Minteger out of range Fint8.c L1008 Rint84: INSERT INTO     "resource_usages" ("measurement_type", "updated_at", "time", "max", "min", "average", "tst_data_id", "created_at") VALUES(E'jmxMemHeapMax', '2009-01-16 12:54:56.600105', 1, 5726666752, 5726666752, 5726666752, 2, '2009-01-16 12:54:56.600105') RETURNING "id"  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract_adapter.rb:147:in `log'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:484:in `execute'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:929:in `select_raw'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/postgresql_adapter.rb:916:in `select'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all_without_query_cache'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract    /database_statements.rb:13:in `select_one'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract  /database_statements.rb:19:in `select_value'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters  /postgresql_adapter.rb:433:in `insert'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:2517:in `create_without_callbacks'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/callbacks.rb:220:in `create_without_timestamps'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/timestamp.rb:29:in `create'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:2483:in `create_or_update_without_callbacks'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/callbacks.rb:207:in `create_or_update'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:2211:in `save_without_validation'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/validations.rb:911:in `save_without_dirty'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/dirty.rb:75:in `save_without_transactions'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/transactions.rb:106:in `save'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/transactions.rb:79:in `transaction'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/transactions.rb:98:in `transaction'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/transactions.rb:106:in `save'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/transactions.rb:118:in `rollback_active_record_state!'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/transactions.rb:106:in `save'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/has_many_association.rb:62:in `insert_record'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/association_collection.rb:102:in `<<'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/association_collection.rb:339:in `add_record_to_target_with_callbacks'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/association_collection.rb:101:in `<<'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/association_collection.rb:99:in `each'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/association_collection.rb:99:in `<<'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/abstract  /database_statements.rb:66:in `transaction'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/transactions.rb:79:in `transaction'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/transactions.rb:98:in `transaction'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/association_collection.rb:98:in `<<'  
/srv/www/vhosts/performanceTesting/app/models/tst_data.rb:80:in `add_resource_usage_data'  
/srv/www/vhosts/performanceTesting/app/models/tst_data.rb:68:in `each'  
/srv/www/vhosts/performanceTesting/app/models/tst_data.rb:68:in `add_resource_usage_data'  
/srv/www/vhosts/performanceTesting/app/models/tst_definition.rb:196:in `run'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/association_proxy.rb:173:in `send'  
/usr/lib64/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/associations/association_proxy.rb:173:in `method_missing'  
/srv/www/vhosts/performanceTesting/app/models/job.rb:54:in `send'  
/srv/www/vhosts/performanceTesting/app/models/job.rb:54:in `start'  
/srv/www/vhosts/performanceTesting/lib/daemons/queue_runner.rb:34  
/srv/www/vhosts/performanceTesting/lib/daemons/queue_runner.rb:29:in `initialize'  
/srv/www/vhosts/performanceTesting/lib/daemons/queue_runner.rb:29:in `new'  
/srv/www/vhosts/performanceTesting/lib/daemons/queue_runner.rb:29  
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:503:in `load'  
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:503:in `load'  
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in `new_constants_in'  
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:503:in `load'  
/usr/lib64/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:176:in `start_load'  
/usr/lib64/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/application.rb:257:in `start'  
/usr/lib64/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/controller.rb:69:in `run'  
/usr/lib64/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:139:in `run'  
/usr/lib64/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `call'  
/usr/lib64/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `catch_exceptions'  
/usr/lib64/ruby/gems/1.8/gems/daemons-1.0.10/lib/daemons.rb:138:in `run'  
./lib/daemons/queue_runner_ctl:26
+1  A: 

The error is at the PostgreSQL level. Error 22003 is the "NUMERIC VALUE OUT OF RANGE" error for PostgreSQL as seen here. A quick glance at your insert statement shows integers that are greater than 32 bits, those might be the culprits.

postfuturist