Commit abad6679 authored by Mark Chao's avatar Mark Chao

Merge branch...

Merge branch '333576-operator-does-not-exist-integer-bigint-in-app-models-namespace-traversal_hierarchy-rb' into 'master'

Resolve "operator does not exist: integer[] || bigint in app/models/namespace/traversal_hierarchy.rb"

See merge request gitlab-org/gitlab!67288
parents a3357f19 1f78b6c6
...@@ -36,7 +36,7 @@ class Namespace ...@@ -36,7 +36,7 @@ class Namespace
SET traversal_ids = cte.traversal_ids SET traversal_ids = cte.traversal_ids
FROM (#{recursive_traversal_ids}) as cte FROM (#{recursive_traversal_ids}) as cte
WHERE namespaces.id = cte.id WHERE namespaces.id = cte.id
AND namespaces.traversal_ids <> cte.traversal_ids AND namespaces.traversal_ids::bigint[] <> cte.traversal_ids
""" """
Namespace.transaction do Namespace.transaction do
@root.lock! @root.lock!
...@@ -51,7 +51,7 @@ class Namespace ...@@ -51,7 +51,7 @@ class Namespace
def incorrect_traversal_ids def incorrect_traversal_ids
Namespace Namespace
.joins("INNER JOIN (#{recursive_traversal_ids}) as cte ON namespaces.id = cte.id") .joins("INNER JOIN (#{recursive_traversal_ids}) as cte ON namespaces.id = cte.id")
.where('namespaces.traversal_ids <> cte.traversal_ids') .where('namespaces.traversal_ids::bigint[] <> cte.traversal_ids')
end end
private private
...@@ -66,9 +66,9 @@ class Namespace ...@@ -66,9 +66,9 @@ class Namespace
<<~SQL <<~SQL
WITH RECURSIVE cte(id, traversal_ids, cycle) AS ( WITH RECURSIVE cte(id, traversal_ids, cycle) AS (
VALUES(#{root_id}, ARRAY[#{root_id}], false) VALUES(#{root_id}::bigint, ARRAY[#{root_id}]::bigint[], false)
UNION ALL UNION ALL
SELECT n.id, cte.traversal_ids || n.id, n.id = ANY(cte.traversal_ids) SELECT n.id, cte.traversal_ids || n.id::bigint, n.id = ANY(cte.traversal_ids)
FROM namespaces n, cte FROM namespaces n, cte
WHERE n.parent_id = cte.id AND NOT cycle WHERE n.parent_id = cte.id AND NOT cycle
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment