openGauss根据表名或者字段名模糊查询表
平时查询一些系统表或视图,可以使用字段名或者表名进行模糊查询
根据表或视图关键字查询
select table_catalog,table_schema,table_name,table_type from information_schema.tables
where table_type in ('BASE TABLE','VIEW')
and table_name ~ '表名'
-- and table_catalog= '';
根据字段名模糊查询
-- PostgreSQL
select attrelid::regclass as tablename,attname from pg_attribute where attname ~* '字段名';
-- 通用查询
select t2.relname as tablename,t1.attname from pg_attribute t1
join pg_class t2 on t1.attrelid=t2.oid
where t2.relkind in ('r','v') and t1.attname ~* '字段名';