Skip to content

Commit 866b067

Browse files
authored
Merge pull request #278 from riskmethods/fix276-speedup-rebuild-in-postgres
speed up rebuild in postgres
2 parents 24c0077 + 6fc88c9 commit 866b067

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/closure_tree/numeric_order_support.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ def reorder_with_parent_id(parent_id, minimum_sort_order_value = nil)
4444
FROM #{quoted_table_name}
4545
WHERE #{where_eq(parent_column_name, parent_id)} #{min_where}
4646
) AS t
47-
WHERE #{quoted_table_name}.#{quoted_id_column_name} = t.id
47+
WHERE #{quoted_table_name}.#{quoted_id_column_name} = t.id and
48+
#{quoted_table_name}.#{quoted_order_column(false)} is distinct from t.seq + #{minimum_sort_order_value.to_i - 1}
4849
SQL
4950
end
5051

0 commit comments

Comments
 (0)