pg 生成数据字典
select (select relname||'--'||(select description from pg_description where objoid=oid and objsubid=0) as comment from pg_class where oid=a.attrelid) as table_name, a.attname as column_name, format_type(a.atttypid,a.atttypmod) as data_type, (case when atttypmod-4>0 then atttypmod-4 else 0 end)data_length, (case when (select count(*) from pg_constraint where conrelid = a.attrelid and conkey[1]=attnum and contype='p')>0 then 'Y' else 'N' end) as 主键约束, (case when (select count(*) from pg_constraint where conrelid = a.attrelid and conkey[1]=attnum and contype='u')>0 then 'Y' else 'N' end) as 唯一约束, (case when (select count(*) from pg_constraint where conrelid = a.attrelid and conkey[1]=attnum and contype='f')>0 then 'Y' else 'N' end) as 外键约束, (case when a.attnotnull=true then 'Y' else 'N' end) as nullable, col_description(a.attrelid,a.attnum) as comment from pg_attribute a where attstattarget=-1 and attrelid in (select oid from pg_class where relname in(select relname from pg_class where relkind ='r' and relname like 'tbl_%')) order by table_name,a.attnum;
pg 生成数据字典的更多相关文章
- 用php生成数据字典
<?php header("Content-type: text/html; charset=utf-8"); $dbserver = "localhost&quo ...
- 使用OpenXml实现生成数据字典文档(beta)
最近项目在走验收流程,之前没有仔细看SOW文档,发现需要补好多份文档,其中就有数据字典,项目组不愿意花时间太多的时间弄这些文档,也不希望以后还要重复劳动力,最终决定做一个工具,方便自己生成数据字典文档 ...
- php生成数据字典,代码
<?php /** * 生成mysql数据字典 */ header("Content-type:text/html;charset=utf-8"); // 配置数据库 $da ...
- 一条SQL生成数据字典
有个字典表并定期维护,对DBA和开发很重要,终于把他们整合在一起了,看有没问题? 一条SQL生成数据字典,包含所有OPEN用户.表名.字段名.字段序号.字段属性.默认值.是否非空.字段意思.主键标识. ...
- SQL server 生成数据字典
Set nocount on ), ) DECLARE Tbls CURSOR FOR ),isnull(g.[value],'-')) AS TABLE_COMMENT FROM INFORMATI ...
- 【PD】PowerDesigner生成数据字典
1.首先说明我使用的环境 --------------------------------第一种:不按模板导出导出数据字典----------------------------- 2.打开PDM模型 ...
- PHP连数据库生成数据字典
<?php /** * 生成mysql数据字典 */ header("Content-type:text/html;charset=utf-8"); // 配置数据库 $da ...
- mysql生成数据字典
git clone https://github.com/twindb/undrop-for-innodb.git make [root@redis01 undrop-for-innodb]# mak ...
- SQL Server 生成 数据字典 / 数据库文档
1. 工具生成 2.SQL语句生成 参考地址:http://blog.csdn.net/qq289523052/article/details/22174721 1.在 表 上右键 - 扩展属性 - ...
随机推荐
- Python基础7:字符串方法
1 * 重复输出字符串 print('helo '*4) 2 [],[:] 通过索引获取字符串中的字符,这里和列表中的切片操作是相同的,具体内容见列表 print('hello word'[2:]) ...
- MySQL架构备份之双机热备
M--S架构:实现双机热备(AB复制) 1.可以降低master读压力 2.可以对数据库做“热备”,热备只能解决硬件master硬件故障,软件故障等重大故障问题,但无法解决人为误操作导致的逻辑故障(列 ...
- (二分查找 拓展) leetcode 162. Find Peak Element && lintcode 75. Find Peak Element
A peak element is an element that is greater than its neighbors. Given an input array nums, where nu ...
- idea 排除编译 参考
参考自 : https://www.bbsmax.com/A/LPdoYLkGJ3/
- Java基础--面向对象编程4(多态)
1.多态的概念 多态是指程序中的同一引用类型,使用不同的实例而执行结果不同的. 同一个类型:一般指父类 不同的实例:不同的子类实例 执行结果不同:针对同一方法执行的结果不同 package cn.sx ...
- PLSQL Developer安装与配置
前言 PLSQL Developer软件以及需要的配置 链接:https://pan.baidu.com/s/1xHdAl1RAgtQb-oDHPah19w 密码:x41k 1 安装 解压这两个压缩包 ...
- .NET面试题系列(十八)常用关键字
序言 const和readonly关键字 private protected public internal的区别 out ref out适合用在需要retrun多个返回值的地方,而ref则用在需要 ...
- ArcGIS——2015年中国各省GDP总量分级图(6等级)
- kali linux工具--信息批量收集工具theharvester
在渗透测试早期阶段,安全人员往往需要从互联网快速获取目标的一些信息,以确认测试目标的概况.为了满足这个需求,Kali Linux提供了theharvester工具.该工具可以搜索引擎.社交网站获取目标 ...
- docker学习------registry可视化的实现
1.Harbor的发现 之前一直在使用registry,但docker pull下来的基础镜像并没用携带UI界面,所以查找了一波开源工具,发现了Harbor这一工具,下面对工具进行一个学习. 2.部 ...