aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-04-01 19:56:34 +0200
committerYves Senn <yves.senn@gmail.com>2014-04-01 20:01:37 +0200
commit06082f66d541e581110406bbac3bc395bace3f86 (patch)
tree7e5f16cbe255baf0e28896c74304fda7e823c545
parentf7a6b115fea9f675190a79b701c7034214678f19 (diff)
downloadrails-06082f66d541e581110406bbac3bc395bace3f86.tar.gz
rails-06082f66d541e581110406bbac3bc395bace3f86.tar.bz2
rails-06082f66d541e581110406bbac3bc395bace3f86.zip
refactor, use `typtype` instead of `typinput` to segment PG types.
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index e8719d5269..0b29f4ca16 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -592,13 +592,13 @@ module ActiveRecord
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