摘要:查询所有表名称以及字段含义表名名称字段字段备注列类型查看所有表名查看表名和备注查看特定表名备注查看特定表名字段
查询所有表名称以及字段含义
select c.relname 表名,cast(obj_description(relfilenode,"pg_class") as varchar) 名称,a.attname 字段,d.description 字段备注,concat_ws("",t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from "(.*)")) as 列类型 from pg_class c,pg_attribute a,pg_type t,pg_description d where a.attnum>0 and a.attrelid=c.oid and a.atttypid=t.oid and d.objoid=a.attrelid and d.objsubid=a.attnum and c.relname in (select tablename from pg_tables where schemaname="public" and position("_2" in tablename)=0) order by c.relname,a.attnum查看所有表名
select tablename from pg_tables where schemaname="public" and position("_2" in tablename)=0; select * from pg_tables;查看表名和备注
select relname as tabname,cast(obj_description(relfilenode,"pg_class") as varchar) as comment from pg_class c where relname in (select tablename from pg_tables where schemaname="public" and position("_2" in tablename)=0); select * from pg_class;查看特定表名备注
select relname as tabname, cast(obj_description(relfilenode,"pg_class") as varchar) as comment from pg_class c where relname ="tbl_alarm";查看特定表名字段
select a.attnum,a.attname,concat_ws("",t.typname,SUBSTRING(format_type(a.atttypid,a.atttypmod) from "(.*)")) as type,d.description from pg_class c,pg_attribute a,pg_type t,pg_description d where c.relname="tbl_alarm" and a.attnum>0 and a.attrelid=c.oid and a.atttypid=t.oid and d.objoid=a.attrelid and d.objsubid=a.attnum;
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/yun/39026.html
摘要:今天在坛子里有人提出了一个问题,问题是这样的在以下指定表中中国辽宁山东沈阳大连济南和平区沈河区现在给定一个号,想得到它完整的名字。递归往上找,直到为止。也就是最高层级时结束,求完整语句。 今天在坛子里有人提出了一个问题,问题是这样的:在以下指定表中 id name fatherid1 中国 02 辽宁 13 山东 14 沈阳 25 大连 26 济南 37 和平区 48 沈河区 4 现在...
摘要:常见类型直接兼容的数组类型。如的,对应的数据源格式,既支持键值对,又支持。书写格式遵守官方规范。格式,支持前缀。其中用户名端口主机名,在数据源中未指定时,有默认值。这能提高倍的执行速度为了发挥好此功能,需要最大可能地允许数据库连接空闲。 用于golang database/sql 的PostgreSQL驱动 showImg(https://godoc.org/github.com/bl...
摘要:给大家介绍一款在线模型生成的工具,可以针对多种数据库的文件在线生成模型图表,支持等数据库。 给大家介绍一款在线ER模型生成的工具,可以针对多种数据库的DDL文件在线生成ER模型图表,支持MySQL、SQLServer、Oracle、PostgreSQL等数据库。主要功能如下: 支持表的创建,同时可以根据数据库的类型不同编辑表结构、字段类型、主键、默认值、索引、备注信息等等 支持视图,...
摘要:让您在线创建流程图系统部署图软件架构图模型组织图软件流程图图表。使用创建数据库模型目前支持及基本的语句建表。后期会进行功能拓展以支持等等数据库模型建模,支持导入生成模型通过语句生成模型模型导出根据模型生成。 概述 ER模型使用可视化了实体存储的信息,以及直观的呈现了实体与实体的关系,在我们实际的应用系统开发过程中新建ER模型可以更好的理解业务模型,为以后的开发维护工作起到归纳总结的作用...
阅读 730·2023-04-25 14:45
阅读 2512·2021-09-30 09:59
阅读 2810·2021-09-22 15:48
阅读 2155·2019-08-30 15:55
阅读 3182·2019-08-30 15:44
阅读 399·2019-08-29 14:07
阅读 3265·2019-08-26 13:45
阅读 384·2019-08-26 11:31