场景描述:navicate 将postgresql表结构导出到Excel。 1、查询表名和表注释 selectrelnameastabname,cast(obj_description(relfilenode,'pg_class')asvarchar)ascommentfrompg_class cwhererelname='t_bt_data'; 2、查询字段名、字段类型及字段长度和字段注释 selecta.attnumAS"序号", c.relnameAS"表名",cast(obj...
2、查询字段名、字段类型及字段长度和字段注释 select a.attnum AS "序号", c.relname AS "表名", cast(obj_description(relfilenode,'pg_class') as varchar) AS "表名描述", a.attname AS "列名", concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '\(.*\)')) ...
2、查询字段名、字段类型及字段长度和字段注释 select a.attnum AS "序号", c.relname AS "表名", cast(obj_description(relfilenode,'pg_class') as varchar) AS "表名描述", a.attname AS "列名", concat_ws('',t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from '\(.*\)')) ...