查询库中所有表
select relname as TABLE_NAME ,col_description(c.oid, 0) as COMMENTS from pg_class c
where relkind = 'r' and relname not like 'pg_%' and relname not like 'sql_%' order by relname
查询表中所有字段、主键、唯一、外键、是否为空
select 'true' as list,'true' as edit,'false' as search,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 P,
(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 U,
(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 R,
(case
when a.attnotnull=true then 'Y'
else 'N'
end) as nullable,
col_description(a.attrelid,a.attnum) as comment,'XEditText' as control
from pg_attribute a
where attstattarget=-1 and attrelid = (select oid from pg_class where relname ='userinfo')
分享到:
相关推荐
PostgresSQL是一个很优秀的开源数据库,并提供了针对空间数据的存扩展;这个PPT介绍了PostgresSQL数据库的基本情况
pgadmin管理工具,支持对postgresqlV11.1以上的版本进行管理。包括存储过程 表分区
postgressql 连接数据库 和关闭数据库
PostgresSQL的简明教程,里面包含了使用方法
主要讲解PostgreSql 10.7 数据库的安装流程,包括系统的优化,环境准备,每一步安装的命令。
数据库备份相关的。
PostgreSQL获取数据库中所有table名及所有字段名,以及获取指定table的所有字段信息
SQL必知必会PostgresSQL数据导入脚本 SQL必知必会PostgresSQL数据导入脚本 SQL必知必会PostgresSQL数据导入脚本
postgressql和postgis安装
PowerDesigner16.5+PostgresSQL
主要介绍了MySQL创建数据表并建立主外键关系详解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
ArcEngine开发连接PostgresSQL空间库Cannot connect to database because the database client software failed to
Postgres数据库SQL注入手册1
1.创建dblink ,2.先执行dblink_connect保持连接,3.执行BEGIN命令,4.执行查询、插入操作,5.执行事务提交,6.解除连接
解压后在pycharm中进行使用,该探查数据库适用于postgres数据库,运行结束后以.xlsx格式进行保存,探查的内容有:数据库名称、数据表名称、数据表注释、排序、字段名称、字段注释、字段类型、字段长度、精度范围、...
PostgresSQL优化
postgres sql psycopg2最新版本,外面的资源部豪侠
PostgresSQL创建数据库和对应用户(附管理工具),文件中包含了数据库管理工具安装包
postgressql-ver-11-win64
用于在postgres定义主键的函数,如更改id update table set id=get_uuid()