Sha256: 63408a219eb93dd2796f9226cac572b7d471a84e38eebe8d37eefc0eb2397eb2

Contents?: true

Size: 728 Bytes

Versions: 15

Compression:

Stored size: 728 Bytes

Contents

# Copyright 2022 Google LLC
#
# Use of this source code is governed by an MIT-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/MIT.

module ActiveRecord
  module CpkExtension
    def cpk_subquery stmt
      return super unless spanner_adapter?
      # The composite_primary_key gem will by default generate WHERE clauses using an IN clause with a multi-column
      # sub select, e.g.: SELECT * FROM my_table WHERE (id1, id2) IN (SELECT id1, id2 FROM my_table WHERE ...).
      # This is not supported in Cloud Spanner. Instead, composite_primary_key should generate an EXISTS clause.
      cpk_exists_subquery stmt
    end
  end

  class Relation
    prepend CpkExtension
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
activerecord-spanner-adapter-1.6.3 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.6.2 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.6.1 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.6.0 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.5.1 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.5.0 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.4.4 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.4.3 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.4.2 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.4.1 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.4.0 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.3.1 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.2.2 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.2.1 lib/activerecord_spanner_adapter/relation.rb
activerecord-spanner-adapter-1.2.0 lib/activerecord_spanner_adapter/relation.rb