i have following table in postgres:
column | type | modifiers -------------------------+-----------------------------+------------------------------------------------ id | uuid | not null name | character varying(255) | not null parent_organization_ids | uuid[] | not null default '{}'::uuid[]
the column parent_organization_ids
contains array parent hierarchy organization, having first root, , in last item parent of current row (if exists).
i need query show current row information, , left join show parent name of current row.
how can left join?
is there alternative this?
solved doing following:
select org.name, parent.name organizations org left join organizations parent on org.parent_organization_ids[array_upper(org.parent_organization_ids, 1)]=parent.id;