【gp】取schema下表及其注释,去除分区表
作者:互联网
【sql】
select a.tablename as tname
b.remark as remark
from
(
select table_name tablename
from information_schem.tables
where upper(table_schema)=upper('your schema')
) a
inner join
(
select * from
(
select cls.relname as tablename,
cast(obj_description(cls.oid,'pg_class') as varchar) as remark
from pg_class cls
left join pa_namespace nspc
on cls.relnamespace=nspc.oid
where upper(nspc.nspname)=upper('your schema') and
cls.relchecks='0' and
cls.relkind='r'
) c
where (c.tablename like '%your keyword%' or c.remark like '%your keyword%'
) b
on a.tablename=b.tablename
order by a.tablename
【参数说明】
your schema:schema名称
your keyword:查询关键字
【注意】
以上代码经过手录而成,其中难免有误,请各位有实际环境的先验证一下。
END
标签:upper,gp,tablename,分区表,cls,your,select,schema 来源: https://www.cnblogs.com/pyhy/p/16607139.html