数据库数据字典生成
<p>select</p>
<p>(select relname from pg_class where oid=a.attrelid) as table_name,</p>
<p>(select (select description from pg_description where objoid = oid and objsubid = 0) ||'表'||'('||relname ||')' from pg_class where oid=a.attrelid) as 表名,</p>
<p>a.attname as 列名,</p>
<p>format_type(a.atttypid,a.atttypmod) as 类型,</p>
<p>col_description(a.attrelid,a.attnum) as 描述</p>
<p>from pg_attribute a where attstattarget=-1</p>
<p>and attrelid in(select oid from pg_class where relname in (select relname as table_name from pg_class where relkind='r' and relnamespace='2200' order by relname))</p>
<p>select DISTINCT table_name from (select</p>
<p>(select relname from pg_class where oid=a.attrelid) as table_name,</p>
<p>(select (select description from pg_description where objoid = oid and objsubid = 0) ||'表'||'('||relname ||')' from pg_class where oid=a.attrelid) as 表名,</p>
<p>a.attname as 列名,</p>
<p>format_type(a.atttypid,a.atttypmod) as 类型,</p>
<p>col_description(a.attrelid,a.attnum) as 描述</p>
<p>from pg_attribute a where attstattarget=-1</p>
<p>and attrelid in(select oid from pg_class where relname in (select relname as table_name from pg_class where relkind='r' and relnamespace='2200' order by relname))
and </p>
<p>(select (select description from pg_description where objoid = oid and objsubid = 0) ||'表'||'('||relname ||')'
from pg_class where oid=a.attrelid) is null ) a ORDER BY table_name</p>