NUBIC / schema_qualified_tables

Logical schema to actual schema name mappings for ActiveRecord models
MIT License
4 stars 3 forks source link

Spec failures with ActiveRecord 3.2.13 #10

Open rsutphin opened 11 years ago

rsutphin commented 11 years ago

Several specs fail on AR 3.2.13 that did not fail on AR 3.2.12:

Failures:

  1) SchemaQualifiedTables sequences with no schema name uses the inferred sequence name
     Failure/Error: Book.sequence_name.should == inferred('books')
     NoMethodError:
       undefined method `error_field' for #<PGresult:0x0000000af48da0>
     # ./lib/bcdatabase/active_record/schema_qualified_tables_override_getters.rb:35:in `sequence_name'
     # ./spec/bcdatabase/active_record/schema_qualified_tables_spec.rb:238:in `block (4 levels) in <top (required)>'

  2) SchemaQualifiedTables sequences with no schema name gives nil if the adapter doesn't specify a default sequence name
     Failure/Error: ActiveRecord::Base.connection.default_sequence_name(table_name)
     NoMethodError:
       undefined method `error_field' for #<PGresult:0x0000000b2913b8>
     # ./spec/bcdatabase/active_record/schema_qualified_tables_spec.rb:230:in `inferred'
     # ./spec/bcdatabase/active_record/schema_qualified_tables_spec.rb:250:in `block (4 levels) in <top (required)>'

  3) SchemaQualifiedTables sequences with schema name uses the inferred sequence name
     Failure/Error: Magazine.sequence_name.should == "reading_material.#{inferred 'magazines'}"
     NoMethodError:
       undefined method `error_field' for #<PGresult:0x0000000a642d50>
     # ./lib/bcdatabase/active_record/schema_qualified_tables_override_getters.rb:35:in `sequence_name'
     # ./spec/bcdatabase/active_record/schema_qualified_tables_spec.rb:265:in `block (4 levels) in <top (required)>'

  4) SchemaQualifiedTables sequences with schema name gives nil if the adapter doesn't specify a default sequence name
     Failure/Error: ActiveRecord::Base.connection.default_sequence_name(table_name)
     NoMethodError:
       undefined method `error_field' for #<PGresult:0x0000000a860e20>
     # ./spec/bcdatabase/active_record/schema_qualified_tables_spec.rb:230:in `inferred'
     # ./spec/bcdatabase/active_record/schema_qualified_tables_spec.rb:269:in `block (4 levels) in <top (required)>'

  5) SchemaQualifiedTables sequences with schema name with name overrides uses the inferred sequence name
     Failure/Error: Pamphlet.sequence_name.should == "rm_test.#{inferred 'pamphlets'}"
     NoMethodError:
       undefined method `error_field' for #<PGresult:0x0000000b3bf258>
     # ./lib/bcdatabase/active_record/schema_qualified_tables_override_getters.rb:35:in `sequence_name'
     # ./spec/bcdatabase/active_record/schema_qualified_tables_spec.rb:357:in `block (5 levels) in <top (required)>'
khiav223577 commented 5 years ago

I got this error in Rails 3.2.22.5. I fixed it by upgrading pg gem from 0.11 to 0.18

The errors messages:

NoMethodError: undefined method `error_field' for #<PGresult:0x007f83548ca3f0>
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activesupport-3.2.22.5/lib/active_support/core_ext/object/try.rb:36:in `try'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/postgresql_adapter.rb:1149:in `translate_exception'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract_adapter.rb:284:in `rescue in log'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `log'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/postgresql_adapter.rb:649:in `execute'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/postgresql_adapter.rb:1266:in `select_raw'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/postgresql_adapter.rb:577:in `select_rows'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/database_statements.rb:38:in `select_values'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-import-0.16.1/lib/activerecord-import/adapters/postgresql_adapter.rb:19:in `insert_many'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-import-0.16.1/lib/activerecord-import/import.rb:541:in `block in import_without_validations_or_callbacks'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-import-0.16.1/lib/activerecord-import/import.rb:539:in `each'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-import-0.16.1/lib/activerecord-import/import.rb:539:in `each_slice'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-import-0.16.1/lib/activerecord-import/import.rb:539:in `import_without_validations_or_callbacks'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-import-0.16.1/lib/activerecord-import/import.rb:490:in `import_with_validations'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-import-0.16.1/lib/activerecord-import/import.rb:427:in `import_helper'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-import-0.16.1/lib/activerecord-import/import.rb:331:in `import'
    /Users/khiav223577/Desktop/github/gem/atomically/lib/atomically/query_service.rb:22:in `create_or_plus'
    /Users/khiav223577/Desktop/github/gem/atomically/test/create_or_plus_test.rb:21:in `block in test_pass_wrong_conflict_target_in_pg'
    /Users/khiav223577/Desktop/github/gem/atomically/test/test_helper.rb:26:in `block in in_sandbox'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    /Users/khiav223577/.rvm/gems/ruby-2.1.8/gems/activerecord-3.2.22.5/lib/active_record/transactions.rb:208:in `transaction'
    /Users/khiav223577/Desktop/github/gem/atomically/test/test_helper.rb:25:in `in_sandbox'
    /Users/khiav223577/Desktop/github/gem/atomically/test/create_or_plus_test.rb:19:in `test_pass_wrong_conflict_target_in_pg'

For someone wants more information: See this pull request