This project is archived and is in readonly mode.
Error in UniquenessValidationTest
Reported by Anuj Dutta | January 17th, 2010 @ 06:53 AM
Only on running test_postgresql
1) Error: test_validate_uniqueness_with_limit_and_utf8(UniquenessValidationTest): ActiveRecord::StatementInvalid: PGError: ERROR: value too long for type character varying(5) : INSERT INTO "events" ("title") VALUES (E'一二三四五') RETURNING "id" /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:206:in `rescue in log' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb:196:in `log' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:552:in `execute' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/test/cases/helper.rb:42:in `execute_with_query_record' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1036:in `select_raw' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:1023:in `select' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `select_all' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all_with_query_cache' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:13:in `select_one' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:19:in `select_value' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:491:in `insert' /Users/andhapp/Projects/git-repository/andhapp-rails/vendor/gems/ruby/1.9.1/dirs/arel/lib/arel/engines/sql/engine.rb:18:in `create' /Users/andhapp/Projects/git-repository/andhapp-rails/vendor/gems/ruby/1.9.1/dirs/arel/lib/arel/algebra/relations/writes.rb:20:in `call' /Users/andhapp/Projects/git-repository/andhapp-rails/vendor/gems/ruby/1.9.1/dirs/arel/lib/arel/session.rb:32:in `create' /Users/andhapp/Projects/git-repository/andhapp-rails/vendor/gems/ruby/1.9.1/dirs/arel/lib/arel/algebra/relations/relation.rb:64:in `insert' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/relation.rb:159:in `method_missing' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/base.rb:2498:in `create' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/timestamp.rb:55:in `create_with_timestamps' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/callbacks.rb:268:in `block in create_with_callbacks' /Users/andhapp/Projects/git-repository/andhapp-rails/activesupport/lib/active_support/callbacks.rb:427:in `_run_create_callbacks' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/callbacks.rb:267:in `create_with_callbacks' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/base.rb:2474:in `create_or_update' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/callbacks.rb:261:in `block in create_or_update_with_callbacks' /Users/andhapp/Projects/git-repository/andhapp-rails/activesupport/lib/active_support/callbacks.rb:427:in `_run_save_callbacks' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/callbacks.rb:260:in `create_or_update_with_callbacks' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/base.rb:2156:in `save' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/validations.rb:47:in `save_with_validation' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/attribute_methods/dirty.rb:19:in `save_with_dirty' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/transactions.rb:229:in `block in with_transaction_returning_status' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/transactions.rb:182:in `transaction' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/transactions.rb:228:in `with_transaction_returning_status' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/transactions.rb:196:in `block in save_with_transactions' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/transactions.rb:196:in `save_with_transactions' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/base.rb:764:in `create' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/test/cases/validations/uniqueness_validation_test.rb:248:in `block in test_validate_uniqueness_with_limit_and_utf8' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/lib/active_record/test_case.rb:60:in `with_kcode' /Users/andhapp/Projects/git-repository/andhapp-rails/activerecord/test/cases/validations/uniqueness_validation_test.rb:246:in `test_validate_uniqueness_with_limit_and_utf8' /Users/andhapp/Projects/git-repository/andhapp-rails/vendor/gems/ruby/1.9.1/gems/mocha-0.9.8/lib/mocha/integration/mini_test/version_131_and_above.rb:26:in `run' /Users/andhapp/Projects/git-repository/andhapp-rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:32:in `block in run' /Users/andhapp/Projects/git-repository/andhapp-rails/activesupport/lib/active_support/callbacks.rb:432:in `_run_setup_callbacks' /Users/andhapp/Projects/git-repository/andhapp-rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:31:in `run' 2194 tests, 7648 assertions, 0 failures, 1 errors, 0 skips
Comments and changes to this ticket
-
Anuj Dutta January 18th, 2010 @ 11:02 AM
This ticket is invalid as the database must be created with utf-8 encoding. Here's the solution:
CREATE DATABASE activerecord_unittest template=template0 encoding='utf-8'; CREATE DATABASE activerecord_unittest2 template=template0 encoding='utf-8';
Related ticket:
https://rails.lighthouseapp.com/projects/16213-rails-guides/tickets... -
Rizwan Reza January 20th, 2010 @ 10:34 AM
- State changed from new to invalid
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>