Skip to content

Commit a232dd5

Browse files
committed
Update sqlserver.rb
1 parent 3a88a8f commit a232dd5

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/arel/visitors/sqlserver.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,18 @@ def visit_Arel_Nodes_Concat(o, collector)
3030
end
3131

3232
def visit_Arel_Nodes_UpdateStatement(o, collector)
33-
if o.orders.any? && o.limit.nil?
34-
o.limit = Nodes::Limit.new(9_223_372_036_854_775_807)
35-
end
3633

37-
if o.key && o.key.size > 1
34+
35+
# binding.pry if $DEBUG
36+
37+
if o.key && o.key.relation.is_a?(Arel::Table) && o.key.relation.instance_variable_get(:@klass).composite_primary_key?
3838
collector.retryable = false
3939
_visit_Arel_Nodes_UpdateStatement(o, collector)
4040
else
41+
if o.orders.any? && o.limit.nil?
42+
o.limit = Nodes::Limit.new(9_223_372_036_854_775_807)
43+
end
44+
4145
super
4246
end
4347
end

0 commit comments

Comments
 (0)