Postgresql Postgres:从架构中的所有视图获取所有列

Postgresql Postgres:从架构中的所有视图获取所有列,postgresql,Postgresql,我想要PostgreSQL数据库中架构内所有视图中的所有列。 我可以使用以下查询找到所有表的类似信息: SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = 'schema_name' 视图而不是表的等价物是什么?只需针对关系类型的pg_类进行连接即可 select * from information_schema.columns join pg_class on table

我想要PostgreSQL数据库中架构内所有视图中的所有列。 我可以使用以下查询找到所有表的类似信息:

SELECT table_name, column_name 
FROM information_schema.columns 
WHERE table_schema = 'schema_name'

视图而不是表的等价物是什么?

只需针对关系类型的pg_类进行连接即可

select *
from information_schema.columns
join pg_class on table_name = relname and relnamespace=table_schema::regnamespace
where relkind = 'v'
;