I want to retrieve all the functional indexes in the postgres db along with their column name. But after tying a lot I am not able to get the functional index column names.
From below query I am able to get the single normal index type.
select t.relname as tableName,
i.relname as indexName,
STRING_AGG(pga.attname||'', ','order by i.relname,pga.attnum) as columnName
from pg_class t
inner join pg_index ix on t.oid = ix.indrelid
inner join pg_class i on i.oid = ix.indexrelid
inner join pg_attribute pga on pga.attrelid = i.oid
inner join pg_indexes pgidx on pgidx.indexname=i.relname
where t.relkind = 'r'
and pgidx.schemaname = ?
group by t.relname, i.relname
having count(*) = 1
order by i.relname