Skip to content
Snippets Groups Projects
Commit 273cc43f authored by Mark Chao's avatar Mark Chao Committed by GitLab Release Tools Bot
Browse files

Resolve "operator does not exist: integer[] || bigint in...

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

See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67288

Changelog: changed
parent 10a5ad9d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -36,7 +36,7 @@ def sync_traversal_ids!
SET traversal_ids = cte.traversal_ids
FROM (#{recursive_traversal_ids}) as cte
WHERE namespaces.id = cte.id
AND namespaces.traversal_ids <> cte.traversal_ids
AND namespaces.traversal_ids::bigint[] <> cte.traversal_ids
"""
Namespace.transaction do
@root.lock!
Loading
Loading
@@ -51,7 +51,7 @@ def sync_traversal_ids!
def incorrect_traversal_ids
Namespace
.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
 
private
Loading
Loading
@@ -66,9 +66,9 @@ def recursive_traversal_ids
 
<<~SQL
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
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
WHERE n.parent_id = cte.id AND NOT cycle
)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment