Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/namespaces/traversal/linear_scopes.rb')
-rw-r--r--app/models/namespaces/traversal/linear_scopes.rb29
1 files changed, 2 insertions, 27 deletions
diff --git a/app/models/namespaces/traversal/linear_scopes.rb b/app/models/namespaces/traversal/linear_scopes.rb
index 81ac026d7ff..843de9bce33 100644
--- a/app/models/namespaces/traversal/linear_scopes.rb
+++ b/app/models/namespaces/traversal/linear_scopes.rb
@@ -41,24 +41,13 @@ module Namespaces
def self_and_descendants(include_self: true)
return super unless use_traversal_ids_for_descendants_scopes?
- if Feature.enabled?(:traversal_ids_btree)
- self_and_descendants_with_comparison_operators(include_self: include_self)
- else
- records = self_and_descendants_with_duplicates_with_array_operator(include_self: include_self)
- distinct = records.select('DISTINCT on(namespaces.id) namespaces.*')
- distinct.normal_select
- end
+ self_and_descendants_with_comparison_operators(include_self: include_self)
end
def self_and_descendant_ids(include_self: true)
return super unless use_traversal_ids_for_descendants_scopes?
- if Feature.enabled?(:traversal_ids_btree)
- self_and_descendants_with_comparison_operators(include_self: include_self).as_ids
- else
- self_and_descendants_with_duplicates_with_array_operator(include_self: include_self)
- .select('DISTINCT namespaces.id')
- end
+ self_and_descendants(include_self: include_self).as_ids
end
def self_and_hierarchy
@@ -181,20 +170,6 @@ module Namespaces
Arel::Nodes::NamedFunction.new('unnest', args)
end
- def self_and_descendants_with_duplicates_with_array_operator(include_self: true)
- base_ids = select(:id)
-
- records = unscoped
- .from("namespaces, (#{base_ids.to_sql}) base")
- .where('namespaces.traversal_ids @> ARRAY[base.id]')
-
- if include_self
- records
- else
- records.where('namespaces.id <> base.id')
- end
- end
-
def superset_cte(base_name)
superset_sql = <<~SQL
SELECT d1.traversal_ids