当前位置:网站首页>postgresql查询【表字段类型】和库中【所有序列】
postgresql查询【表字段类型】和库中【所有序列】
2022-07-28 06:58:00 【欧晨eli】
1、查询所有表名字,默认schema名字是public
SELECT
tablename
FROM
pg_tables
WHERE
schemaname = 'public'
2、查询已知表名tableName的所有字段的字段名、类型、是否为空、注释
SELECT
A.attname AS NAME,
format_type(A.atttypid, A.atttypmod) AS TYPE,
A.attnotnull AS NOTNULL,
col_description(A.attrelid, A.attnum) AS COMMENT
FROM
pg_class AS C,
pg_attribute AS A
WHERE
C.relname = 'tableName'
AND A.attnum > 0
AND A.attrelid = C.oid
3、查询数据库相应用户userName的所有序列
SELECT
*
FROM
pg_class
WHERE
relowner = (SELECT usesysid FROM pg_user WHERE usename = 'userName')
AND relkind = 'S'边栏推荐
- 2022 Niuke multi school first problem solving Report
- tkMapper的使用-超详细
- leetcode/单词长度的最大乘积
- SQL function
- sql server时间字段排序
- Brief introduction to ThreadLocal class
- Draw.io image saving path settings
- CI框架如何集成Smarty模板
- 二维数组及操作
- [chart component kit] Shanghai daoning provides developers with steema download, trial and tutorial
猜你喜欢

Prescan quick start to proficient in lecture 17, speed curve editor

SQL注入 ----前置基础

c语言中函数的介绍(血书20000字!!!!)

The fourth phase (2021-2022) research on the implementation of cloud native technology in traditional industries - central state-owned enterprises was officially released

Five screens, VR, projection, "Wei Xiaoli" rolled up on the intelligent cockpit

uniapp---- 获取当前位置的经纬度等信息的详细步骤(包含小程序)

uniapp的swiper动态设置current值不生效解决办法

中标捷报!南大通用GBase 8s中标南瑞集团2022年数据库框架项目

Understand the propagation process of EMI electromagnetic interference through five diagrams - the influence of square wave steepness on high-frequency components, the spectrum graph from time sequenc

How to write a JMeter script common to the test team
随机推荐
Technology sharing | common proxy tools for interface testing
Five screens, VR, projection, "Wei Xiaoli" rolled up on the intelligent cockpit
PHP基础知识 - PHP 使用 PDO
Opencv+paddle Orc recognize pictures and extract table information
(Reprinted) plantuml Quick Guide
半桥BUCK电路—记录篇
Prescan quick start to master the transportation elements in lesson 14, prescan
pyspark 写入数据到iceberg
Leetcode/ sum of two numbers in a sorted array
Kubernetes技术与架构(七)
JS cartoon English alphabet typing game source code
中标捷报!南大通用GBase 8s中标南瑞集团2022年数据库框架项目
2022 Niuke multi school second problem solving Report
One key switch circuit
解决EMC、EMI传导干扰的八大方法
一键开关机电路
Pyspark writes data to iceberg
Regular expression for mobile number verification
leetcode/单词长度的最大乘积
leetcode/数组中和为0的三个不同数