PostgreSQL-查询表的字段(属性)定义-pg_attribute

news/2024/7/9 23:32:15 标签: postgresql

pg_attribute表中存储了每个表的属性信息,此表的 pg_attribute.attrelid字段是每个表在对应的 pg_class.oid的值。
例如获取pg_attribute表自己的字段定义信息的命令如下:

select
	attrelid,
	attnum,
	attname,
	attnotnull
from
	pg_attribute
where
	attrelid = (select oid from pg_class where relname = 'pg_attribute') order by attnum;

查询结果

 attrelid | attnum |    attname    | attnotnull
----------+--------+---------------+------------
     1249 |     -7 | tableoid      | t
     1249 |     -6 | cmax          | t
     1249 |     -5 | xmax          | t
     1249 |     -4 | cmin          | t
     1249 |     -3 | xmin          | t
     1249 |     -1 | ctid          | t
     1249 |      1 | attrelid      | t
     1249 |      2 | attname       | t
     1249 |      3 | atttypid      | t
     1249 |      4 | attstattarget | t
     1249 |      5 | attlen        | t
     1249 |      6 | attnum        | t
     1249 |      7 | attndims      | t
     1249 |      8 | attcacheoff   | t
     1249 |      9 | atttypmod     | t
     1249 |     10 | attbyval      | t
     1249 |     11 | attstorage    | t
     1249 |     12 | attalign      | t
     1249 |     13 | attnotnull    | t
     1249 |     14 | atthasdef     | t
     1249 |     15 | attidentity   | t
     1249 |     16 | attisdropped  | t
     1249 |     17 | attislocal    | t
     1249 |     18 | attinhcount   | t
     1249 |     19 | attcollation  | t
     1249 |     20 | attacl        | f
     1249 |     21 | attoptions    | f
     1249 |     22 | attfdwoptions | f
(28 rows)

参考文档


http://www.niftyadmin.cn/n/788698.html

相关文章

JavaWeb——SSM管理系统脚手架-介绍、原理

QQ 1274510382 Wechat JNZ_aming 商业互捧 QQ群538250800 技术搞事 QQ群599020441 技术合作 QQ群152889761 加入我们 QQ群649347320 纪年科技aming 网络安全 ,深度学习,嵌入式,机器强化,生物智能,生命科学。

PostgreSQL-获取一个表的所有分区表

表的分区关系存储在pg_inherits中,其定义如下: Table "pg_catalog.pg_inherits"Column | Type | Collation | Nullable | Default | Storage | Stats target | Description -----------------------------------------------------------…

git 命令支持的的代码仓库地址

通过 git push --help 命令查看帮助信息中的 URLs 支持信息 . ssh://[user]host.xz[:port]/path/to/repo.git/ . git://host.xz[:port]/path/to/repo.git/ . http[s]://host.xz[:port]/path/to/repo.git/ . ftp[s]://host.xz[:port]/path/to/repo.git/ 可以使用如下命令添加远…

Spark Streaming流式计算的WordCount入门

[sizemedium] Spark Streaming是一种近实时的流式计算模型,它将作业分解成一批一批的短小的批处理任务,然后并行计算,具有可扩展,高容错,高吞吐,实时性高等一系列优点,在某些场景可达到与Storm一…

Java微服务——商城项目工程搭建

QQ 1274510382 Wechat JNZ_aming 商业互捧 QQ群538250800 技术搞事 QQ群599020441 技术合作 QQ群152889761 加入我们 QQ群649347320 纪年科技aming 网络安全 ,深度学习,嵌入式,机器强化,生物智能,生命科学。 微服务工程结构搭建 错误:Maven Resources Compiler: Maven project …

计算机网络原理——网络地址转换(NAT)

QQ 1274510382 Wechat JNZ_aming 商业互捧 QQ群538250800 技术搞事 QQ群599020441 技术合作 QQ群152889761 加入我们 QQ群649347320 纪年科技aming 网络安全 ,深度学习,嵌入式,机器强化,生物智能,生命科学。 端口 镜像 抓包 抓的是 192.168.1.0 物理机地址

Python:Python3中的print

在 Python3 中,print 是一个函数,通过 help(print) 可以看到 print 函数的参数: (myvenv) [roothostname 13:15:47 ~]$ python Python 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux Type &qu…

如何使用Spark大规模并行构建索引

使用Spark构建索引非常简单,因为spark提供了更高级的抽象rdd分布式弹性数据集,相比以前的使用Hadoop的MapReduce来构建大规模索引,Spark具有更灵活的api操作,性能更高,语法更简洁等一系列优点。 先看下,整…