composite_primary_keys 13.0.5 → 13.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e705c71e8e7a1f2d4aee39d46ba133177960963c2d126ee41caea675ad743dfe
|
4
|
+
data.tar.gz: 266bba1595212c20101e3052cc2a24de8654ce817412b82cfbacee6cf3044c56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80a8ad394e2393f3fbae332a9ba5d8db8bea4484b09834e5ef0749395b188e796e13cab5625688530e4f299464400e2cf0dc67a37f6a27160890cbe08ae8857d
|
7
|
+
data.tar.gz: 48a459a2296938f41a40e98e8f533ae0d7ee8bcd427406dd05af4a1a697466c19e1ba4d4c2212b7d4518e1308ef528ec83f1d52b5b59808016c65d8314c3f074
|
data/History.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 13.0.7 (2023-02-04)
|
2
|
+
* Fix #573 (Charlie Savage)
|
3
|
+
|
4
|
+
== 13.0.6 (2023-02-04)
|
5
|
+
* Fix #577 (Charlie Savage)
|
6
|
+
|
1
7
|
== 13.0.5 (2023-02-04)
|
2
8
|
* Improve query generation for cpk_in_predicate. This reduces the length of
|
3
9
|
queries when loading many keys and enables Postgres to use index scans
|
@@ -33,20 +33,28 @@ module ActiveRecord
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
owners_by_key[
|
46
|
-
(
|
36
|
+
def load_records
|
37
|
+
# owners can be duplicated when a relation has a collection association join
|
38
|
+
# #compare_by_identity makes such owners different hash keys
|
39
|
+
@records_by_owner = {}.compare_by_identity
|
40
|
+
raw_records = owner_keys.empty? ? [] : records_for(owner_keys)
|
41
|
+
|
42
|
+
@preloaded_records = raw_records.select do |record|
|
43
|
+
assignments = false
|
44
|
+
|
45
|
+
owners_by_key[convert_key(record[association_key_name])].each do |owner|
|
46
|
+
entries = (@records_by_owner[owner] ||= [])
|
47
|
+
|
48
|
+
if reflection.collection? || entries.empty?
|
49
|
+
entries << record
|
50
|
+
assignments = true
|
51
|
+
end
|
47
52
|
end
|
53
|
+
|
54
|
+
assignments
|
48
55
|
end
|
49
56
|
end
|
57
|
+
|
50
58
|
end
|
51
59
|
end
|
52
60
|
end
|
@@ -29,7 +29,7 @@ module ActiveRecord
|
|
29
29
|
stmt.key = table[primary_key]
|
30
30
|
|
31
31
|
# CPK
|
32
|
-
if @klass.composite?
|
32
|
+
if @klass.composite?
|
33
33
|
stmt = Arel::UpdateManager.new
|
34
34
|
stmt.table(arel_table)
|
35
35
|
cpk_subquery(stmt)
|
@@ -74,7 +74,7 @@ module ActiveRecord
|
|
74
74
|
stmt.key = table[primary_key]
|
75
75
|
|
76
76
|
# CPK
|
77
|
-
if @klass.composite?
|
77
|
+
if @klass.composite?
|
78
78
|
stmt = Arel::DeleteManager.new
|
79
79
|
stmt.from(arel_table)
|
80
80
|
cpk_subquery(stmt)
|
data/test/abstract_unit.rb
CHANGED