Skip to content

Commit af2b1da

Browse files
authored
Merge pull request rails#49452 from Shopify/pg-ensure-type-map-loaded
Ensure PG connection is configured before looking up types
2 parents 7c303b9 + 618db13 commit af2b1da

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def type_cast(value) # :nodoc:
149149
end
150150

151151
def lookup_cast_type_from_column(column) # :nodoc:
152+
verify! if type_map.nil?
152153
type_map.lookup(column.oid, column.fmod, column.sql_type)
153154
end
154155

activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,7 @@ def initialize_type_map(m) # :nodoc:
722722
end
723723

724724
private
725-
def type_map
726-
@type_map ||= Type::HashLookupTypeMap.new
727-
end
725+
attr_reader :type_map
728726

729727
def initialize_type_map(m = type_map)
730728
self.class.initialize_type_map(m)

0 commit comments

Comments
 (0)