13668: Replaced package_version with packageVersion on discovery doc.
[arvados.git] / services / api / lib / create_ancestor_view.sql
1 -- Copyright (C) The Arvados Authors. All rights reserved.
2 --
3 -- SPDX-License-Identifier: AGPL-3.0
4
5 CREATE TEMPORARY VIEW ancestor_view AS
6 WITH RECURSIVE
7 ancestor (uuid, ancestor_uuid) AS (
8      SELECT groups.uuid::varchar(32)       AS uuid,
9             groups.owner_uuid::varchar(32) AS ancestor_uuid
10             FROM groups
11      UNION
12      SELECT ancestor.uuid::varchar(32)     AS uuid,
13             groups.owner_uuid::varchar(32) AS ancestor_uuid
14             FROM ancestor
15             INNER JOIN groups
16             ON groups.uuid = ancestor.ancestor_uuid
17 )
18 SELECT * FROM ancestor;