diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-11-19 11:24:49 -0800 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-11-19 11:24:49 -0800 |
commit | b03f9ef86a44b190948be0737bf9ab68e30fc112 (patch) | |
tree | 435f0fb71c6aebbde9087dc372a4491c2f9d590d /activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | |
parent | 74c35b46e362a128fe06f909744da8bb1aeed0e0 (diff) | |
download | rails-b03f9ef86a44b190948be0737bf9ab68e30fc112.tar.gz rails-b03f9ef86a44b190948be0737bf9ab68e30fc112.tar.bz2 rails-b03f9ef86a44b190948be0737bf9ab68e30fc112.zip |
Revert "PERF: optimise type lookup to avoid invoking procs"
This reverts commit da99a2a2982d35f670ad9647463e09bfe9032b70.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index d3e5b0a4ad..6310d70192 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -431,22 +431,16 @@ module ActiveRecord private def get_oid_type(oid, fmod, column_name, sql_type = '') # :nodoc: - - result = type_map.fetch(oid, fmod, sql_type) { - nil - } - - unless result + if !type_map.key?(oid) load_additional_types(type_map, [oid]) - result = type_map.fetch(oid, fmod, sql_type) { - warn "unknown OID #{oid}: failed to recognize type of '#{column_name}'. It will be treated as String." - Type::Value.new.tap do |cast_type| - type_map.register_type(oid, cast_type) - end - } end - result + type_map.fetch(oid, fmod, sql_type) { + warn "unknown OID #{oid}: failed to recognize type of '#{column_name}'. It will be treated as String." + Type::Value.new.tap do |cast_type| + type_map.register_type(oid, cast_type) + end + } end def initialize_type_map(m) # :nodoc: |