在使用postgresql数据库,或者opengauss数据库时,如果要通过模式名(schema)和表名(table),查询表的描述信息,可以使用下面的SQL:
select pt.schemaname, pt.tablename ,pd.description from pg_description pd
left join pg_class pc on pd.objoid = pc.oid
left join pg_tables pt on pc.relname = pt.tablename
where pt.schemaname = ? and pt.tablename = ? and pd.objsubid = 0
sql执行结果: