diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index <HASH>..<HASH> 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -588,7 +588,7 @@ module ActiveRecord
             SQL
           else
             result = execute(<<-SQL, 'SCHEMA')
-              SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput
+              SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, t.typtype, t.typbasetype
               FROM pg_type as t
             SQL
           end
@@ -630,10 +630,11 @@ module ActiveRecord
 
           # populate domain types
           domains.each do |row|
-            if base_type = type_map[row["typbasetype"].to_i]
+            base_type_oid = row["typbasetype"].to_i
+            if base_type = type_map[base_type_oid]
               type_map[row['oid'].to_i] = base_type
             else
-              warn "unknown base type (OID: #{row["typbasetype"].to_i}) for domain #{row["typname"]}."
+              warn "unknown base type (OID: #{base_type_oid}) for domain #{row["typname"]}."
             end
           end
         end
fix, adjust OID query without range support to include required fields.

This is a follow-up fix to f7a6b<I>fea9f<I>a<I>b<I>c<I>f<I> and
<I>f<I>d<I>e<I>bbac3bc<I>bace3f<I>