Sha256: 4e144bbf39ee9b284be8817450cfb42170b8614f6eb2d3bfbda4e9e8e76ccbff

Contents?: true

Size: 852 Bytes

Versions: 24

Compression:

Stored size: 852 Bytes

Contents

module ActiveRecord
  module ConnectionAdapters
    module CockroachDB
      module OID
        module TypeMapInitializer
          # override
          # Replaces the query with a faster version that doesn't rely on the
          # use of 'array_in(cstring,oid,integer)'::regprocedure.
          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
        end

        PostgreSQL::OID::TypeMapInitializer.prepend(TypeMapInitializer)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
activerecord-cockroachdb-adapter-6.0.0.pre.beta.5 lib/active_record/connection_adapters/cockroachdb/oid/type_map_initializer.rb
activerecord-cockroachdb-adapter-6.1.0.pre.beta.3 lib/active_record/connection_adapters/cockroachdb/oid/type_map_initializer.rb
activerecord-cockroachdb-adapter-6.1.0.pre.beta.2 lib/active_record/connection_adapters/cockroachdb/oid/type_map_initializer.rb
activerecord-cockroachdb-adapter-6.0.0.pre.beta.4 lib/active_record/connection_adapters/cockroachdb/oid/type_map_initializer.rb