activerecord-sqlserver-adapter 7.1.9 → 7.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c9a920a4f60419f9224af3015631bceb30eea4b70356e947f26f9c05feaff3a
4
- data.tar.gz: '08182d688ca9aa20b42f4a42e29580335665f751d873fc1443d71e3d03a550bd'
3
+ metadata.gz: 51943ff8896e187bfaaacc10538c141f72cf0afe8a4b485999259ec91af62af9
4
+ data.tar.gz: 257d760d9bb1c655447a9b21cab497cbca0c3cf6aa37b840149e239fa19d8051
5
5
  SHA512:
6
- metadata.gz: 2f72132748467ea80ed8f364f32522cb0b59a678b2895875d485473328f017d34c39cf8d60fc916ee0fa1d1c0344f078d0ff30ec67caff38e978961d2eaf9c2c
7
- data.tar.gz: cca704ba3fbda50765708251a1d2c3f081e0d2258505eac05d759bbe7455e4b81692e80d94a7f02e45c29d497624e3d285d41883e893a8af3451be18c4d99618
6
+ metadata.gz: ad5478179fc31c9cd50ad4bedc8ba9affbff6f0d0eeb21066de9ab5d8b6a60d61f5c3221d3969d6484455be1845e8c1e9643d807f76733e0b45b4d5e75cadf7b
7
+ data.tar.gz: 4c1ececbe3b65b77a45b9234cb91f9d3b322840d6f10617def9188147b34b8b620cfb4c5a688ac6221f0e6c6b1a30345eade2e9c7e7965f4650ec4f8dfb7ce04
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v7.1.10
2
+
3
+ #### Fixed
4
+
5
+ - [#1262](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1262) Fix distinct alias when multiple databases used.
6
+
1
7
  ## v7.1.9
2
8
 
3
9
  #### Fixed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.1.9
1
+ 7.1.10
@@ -347,12 +347,16 @@ module ActiveRecord
347
347
 
348
348
  def columns_for_distinct(columns, orders)
349
349
  order_columns = orders.reject(&:blank?).map { |s|
350
- s = s.to_sql unless s.is_a?(String)
350
+ s = visitor.compile(s) unless s.is_a?(String)
351
351
  s.gsub(/\s+(?:ASC|DESC)\b/i, "")
352
352
  .gsub(/\s+NULLS\s+(?:FIRST|LAST)\b/i, "")
353
- }.reject(&:blank?).map.with_index { |column, i| "#{column} AS alias_#{i}" }
353
+ }
354
+ .reject(&:blank?)
355
+ .reject { |s| columns.include?(s) }
354
356
 
355
- (order_columns << super).join(", ")
357
+ order_columns_aliased = order_columns.map.with_index { |column, i| "#{column} AS alias_#{i}" }
358
+
359
+ (order_columns_aliased << super).join(", ")
356
360
  end
357
361
 
358
362
  def update_table_definition(table_name, base)
@@ -581,4 +581,13 @@ class AdapterTestSQLServer < ActiveRecord::TestCase
581
581
  end
582
582
  end
583
583
  end
584
+
585
+ describe "distinct select query" do
586
+ it "generated SQL does not contain unnecessary alias projection" do
587
+ sqls = capture_sql do
588
+ Post.includes(:comments).joins(:comments).first
589
+ end
590
+ assert_no_match(/AS alias_0/, sqls.first)
591
+ end
592
+ end
584
593
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-sqlserver-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.9
4
+ version: 7.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2024-11-10 00:00:00.000000000 Z
18
+ date: 2024-12-08 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: activerecord
@@ -240,8 +240,8 @@ licenses:
240
240
  - MIT
241
241
  metadata:
242
242
  bug_tracker_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues
243
- changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.1.9/CHANGELOG.md
244
- source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.1.9
243
+ changelog_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/blob/v7.1.10/CHANGELOG.md
244
+ source_code_uri: https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/tree/v7.1.10
245
245
  post_install_message:
246
246
  rdoc_options: []
247
247
  require_paths: