How I can find out which views use other views in their sql code that generates them? I am mapping the view usage on an uknown database scheme. I was provided with a list with some views:
view_a
view_b
view_c

And I want to search my database which views depend on another views for example if view_c is generated via the following sql query:
CREATE VIEW view_c AS SELECT * from view_a JOIN view_b WHERE view_a.column=344

I want somehow to list that view_c uses view_a and view_b upon excell sheet. For now is done manually via looking the views dll sql on Dbeaver and figuring out from it. But it is very laborious job and may miss some view dependencies as well, so do you have any idea how If I can generate the excell sheet via a query from information_schema.* tables?
You can get which view uses another view with the following query:
select 
    pg_views.viewname ,
    pg_views2.viewname as view_used from pg_views, pg_views as pg_views2 
where 
    pg_views.definition ilike '%'||pg_views2.viewname||'%' 
    and pg_views.viewname &lt;&gt; pg_views2.viewname
    and pg_views.schemaname = 'public' and pg_views2.schemaname='public'
;

And In case you want to search a specific list of views:
select 
    pg_views.viewname ,
    pg_views2.viewname as view_used from pg_views, pg_views as pg_views2 
where 
    pg_views.definition ilike '%'||pg_views2.viewname||'%' 
    and pg_views.viewname &lt;&gt; pg_views2.viewname
    and pg_views.schemaname = 'public' 
    and pg_views2.schemaname='public'
    and pg_views2.viewname in ('view_a','view_b','view_c')
;

In case that you need which materialized view uses another materialized view then you can use this query:
select 
    pg_matviews.matviewname ,
    pg_matviews2.matviewname as view_used from pg_matviews, pg_matviews as pg_matviews2 
where 
    pg_matviews.definition ilike '%'||pg_matviews2.matviewname||'%' 
    and pg_matviews.matviewname &lt;&gt; pg_matviews2.matviewname
    and pg_matviews.schemaname = 'public' 
    and pg_matviews2.schemaname='public'
;

The whole idea is to use either the pg_views for normal views or pg_matviews join them together and search which view used another view into their sql code.
For example in order to see which view uses another materialized view:
select 
    pg_views.viewname ,
    pg_matviews.matviewname as view_used 
from pg_views, pg_matviews 
where 
    pg_views.definition ilike '%'||pg_matviews.matviewname||'%' 
    and pg_views.schemaname = 'public' 
    and pg_matviews.schemaname='public'
;

It was tested upon postgresql 11.