\d
对于每个与 pattern 匹配的关系(表、视图、物化视图、索引、序列或外部表)或复合类型,显示所有列、它们的类型、表空间(如果不是默认的)以及任何特殊属性,如 NOT NULL 或默认值。还显示相关的索引、约束、规则和触发器。对于外部表,还显示关联的外部服务器。( “ 匹配模式 ” 的定义在下面的 模式 中。)
当前查看 PostgreSQL 18.6。
说明
对于每个与 pattern 匹配的关系(表、视图、物化视图、索引、序列或外部表)或复合类型,显示所有列、它们的类型、表空间(如果不是默认的)以及任何特殊属性,如 NOT NULL 或默认值。还显示相关的索引、约束、规则和触发器。对于外部表,还显示关联的外部服务器。( “ 匹配模式 ” 的定义在下面的 模式 中。)
- 客户端
- psql 18.6
- 区分大小写的写法
- \d
用法
\d[Sx+] [ pattern ]本版手册中的写法
| 命令 | 手册中的后缀修饰符 |
|---|---|
| \d | Sx+ |
手册定义
\d[Sx+] [pattern]-
对于每个与
pattern匹配的关系(表、视图、物化视图、索引、序列或外部表)或复合类型,显示所有列、它们的类型、表空间(如果不是默认的)以及任何特殊属性,如NOT NULL或默认值。还显示相关的索引、约束、规则和触发器。对于外部表,还显示关联的外部服务器。(“匹配模式”的定义在下面的模式中。)对于某些类型的关系,
\d显示每列的附加信息:序列的列值,索引的索引表达式,外部表的外部数据包装器选项。命令形式
\d+与前者相同,但会显示更多信息:表列关联的注释、表是否包含 OID、当关系为视图时的视图定义、非默认的复制标识设置,以及当关系具有访问方法时的访问方法名称。默认情况下,只显示用户创建的对象;提供一个模式或
S修饰符以包括系统对象。注意
如果使用
\d而没有pattern参数,它等同于\dtvmsE,它将显示所有可见的表、视图、物化视图、序列和外部表的列表。这纯粹是一种便利措施。与许多其他命令一样,在命令名后添加 x 会使用扩展显示模式。但这仅适用于不带 pattern 参数的 \d,且 x 不能紧跟 \d(因为 \dx 是另一个命令),只能位于 S 或 + 修饰符之后。例如,\d+x 等价于 \dtvmsE+x,将以扩展模式列出所有关系。
相关条目
文档与源码
来源构建
- 版本
- 18.6
- 构建
- https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2
- 来源指纹
ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8
版本比较
PostgreSQL 17 → 18: 属性变化。
以下差异保留原始字段名与英文源描述。
--- PostgreSQL 17
+++ PostgreSQL 18
@@ -1,12 +1,12 @@
{
- "definition": "For each relation (table, view, materialized view, index, sequence, or foreign table) or composite type matching the pattern , show all columns, their types, the tablespace (if not the default) and any special attributes such as NOT NULL or defaults. Associated indexes, constraints, rules, and triggers are also shown. For foreign tables, the associated foreign server is shown as well. ( “ Matching the pattern ” is defined in Patterns below.) For some types of relation, \\d shows additional information for each column: column values for sequences, indexed expressions for indexes, and foreign data wrapper options for foreign tables. The command form \\d+ is identical, except that more information is displayed: any comments associated with the columns of the table are shown, as is the presence of OIDs in the table, the view definition if the relation is a view, a non-default replica identity setting and the access method name if the relation has an access method. By default, only user-created objects are shown; supply a pattern or the S modifier to include system objects. Note If \\d is used without a pattern argument, it is equivalent to \\dtvmsE which will show a list of all visible tables, views, materialized views, sequences and foreign tables. This is purely a convenience measure.",
+ "definition": "For each relation (table, view, materialized view, index, sequence, or foreign table) or composite type matching the pattern , show all columns, their types, the tablespace (if not the default) and any special attributes such as NOT NULL or defaults. Associated indexes, constraints, rules, and triggers are also shown. For foreign tables, the associated foreign server is shown as well. ( “ Matching the pattern ” is defined in Patterns below.) For some types of relation, \\d shows additional information for each column: column values for sequences, indexed expressions for indexes, and foreign data wrapper options for foreign tables. The command form \\d+ is identical, except that more information is displayed: any comments associated with the columns of the table are shown, as is the presence of OIDs in the table, the view definition if the relation is a view, a non-default replica identity setting and the access method name if the relation has an access method. By default, only user-created objects are shown; supply a pattern or the S modifier to include system objects. Note If \\d is used without a pattern argument, it is equivalent to \\dtvmsE which will show a list of all visible tables, views, materialized views, sequences and foreign tables. This is purely a convenience measure. As with many other commands, if x is appended to the command name, the results are displayed in expanded mode, but note that this only applies when \\d is used without a pattern argument, and the x modifier cannot appear immediately after the \\d (because \\dx is a different command); the x modifier may only appear after an S or + modifier. For example, \\d+x is equivalent to \\dtvmsE+x and will show a list of all relations in expanded mode.",
"modifiers": [
{
"command": "\\d",
- "modifiers": "S+"
+ "modifiers": "Sx+"
}
],
- "signature": "\\d[S+] [ pattern ]",
+ "signature": "\\d[Sx+] [ pattern ]",
"spellings": [
"\\d"
]
比较已记录的接口与属性,排除来源指纹和构建元数据。某个样本中没有记录,不能据此判断实际引入或移除的版本。
相关条目
导出 JSON · 返回psql 命令 · 收录范围为 PostgreSQL 10 至 20;最早采样版本不一定是实际引入版本。