Module: ActiveRecord::CpkExtension

Included in:
Relation
Defined in:
lib/activerecord_spanner_adapter/relation.rb

Instance Method Summary collapse

Instance Method Details

#cpk_subquery(stmt) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/activerecord_spanner_adapter/relation.rb', line 9

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