psql 可以输出所有表的描述,但只输出表吗?

Can psql output a description of all tables, but only tables?

当我这样做时 \d public.* 我得到了表的描述列表,还有所有其他索引等。

当我执行 \dt public.* 时,我得到一个表名列表,但不是这些表的完整描述。

是否有一个命令可以提供所有表的完整描述而不包含其他对象类型?

使用的版本:psql --version 输出 psql (PostgreSQL) 11.5

你可以使用 obj_description()

select tbl.relname as table_name, 
       obj_description(tbl.oid) as comment
from pg_class tbl
  join pg_namespace n on n.oid = tbl.relnamespace
where n.nspname = 'public' 
  and tbl.relkind = 'r' ;