Permalink
Browse files

refactor, use `typtype` instead of `typinput` to segment PG types.

  • Loading branch information...
1 parent f7a6b11 commit 06082f66d541e581110406bbac3bc395bace3f86 @senny senny committed Apr 1, 2014
Showing with 3 additions and 3 deletions.
  1. +3 −3 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -592,13 +592,13 @@ def initialize_type_map(type_map)
FROM pg_type as t
SQL
end
- ranges, nodes = result.partition { |row| row['typinput'] == 'range_in' }
+ ranges, nodes = result.partition { |row| row['typtype'] == 'r' }
+ enums, nodes = nodes.partition { |row| row['typtype'] == 'e' }
domains, nodes = nodes.partition { |row| row['typtype'] == 'd' }
- leaves, nodes = nodes.partition { |row| row['typelem'] == '0' }
arrays, nodes = nodes.partition { |row| row['typinput'] == 'array_in' }
+ leaves, nodes = nodes.partition { |row| row['typelem'] == '0' }
# populate the enum types
- enums, leaves = leaves.partition { |row| row['typinput'] == 'enum_in' }
enums.each do |row|
type_map[row['oid'].to_i] = OID::Enum.new
end

0 comments on commit 06082f6

Please sign in to comment.