Module: ActiveRecord::ConnectionAdapters::CockroachDB::OID::TypeMapInitializer

Defined in:
lib/active_record/connection_adapters/cockroachdb/oid/type_map_initializer.rb

Instance Method Summary collapse

Instance Method Details

#query_conditions_for_initial_loadObject

override Replaces the query with a faster version that doesn't rely on the use of 'array_in(cstring,oid,integer)'::regprocedure.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/active_record/connection_adapters/cockroachdb/oid/type_map_initializer.rb', line 9

def query_conditions_for_initial_load
  known_type_names = @store.keys.map { |n| "'#{n}'" }
  known_type_types = %w('r' 'e' 'd')
  <<~SQL % [known_type_names.join(", "), known_type_types.join(", ")]
    WHERE
      t.typname IN (%s)
      OR t.typtype IN (%s)
      OR (t.typarray = 0 AND t.typcategory='A')
      OR t.typelem != 0
  SQL
end