按 PostgreSQL 版本定义
pg_shdescription (PostgreSQL 19)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | C | not null |
Indexes:
"pg_shdescription_o_c_index" PRIMARY KEY, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 18)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | C | not null |
Indexes:
"pg_shdescription_o_c_index" PRIMARY KEY, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 17)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | C | not null |
Indexes:
"pg_shdescription_o_c_index" PRIMARY KEY, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 16)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | C | not null |
Indexes:
"pg_shdescription_o_c_index" PRIMARY KEY, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 15)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | C | not null |
Indexes:
"pg_shdescription_o_c_index" PRIMARY KEY, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 14)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | C | not null |
Indexes:
"pg_shdescription_o_c_index" PRIMARY KEY, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 13)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | C | not null |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 12)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | C | not null |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 11)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | | not null |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 10)
Table "pg_catalog.pg_shdescription"
Column | Type | Collation | Nullable | Default
-------------+------+-----------+----------+---------
objoid | oid | | not null |
classoid | oid | | not null |
description | text | | not null |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 9.6)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text | not null
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 9.5)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text | not null
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 9.4)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 9.3)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 9.2)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 9.1)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 9.0)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 8.4)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 8.3)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
pg_shdescription (PostgreSQL 8.2)
Table "pg_catalog.pg_shdescription"
Column | Type | Modifiers
-------------+------+-----------
objoid | oid | not null
classoid | oid | not null
description | text |
Indexes:
"pg_shdescription_o_c_index" UNIQUE, btree (objoid, classoid), tablespace "pg_global"
Tablespace: "pg_global"
文档: pg_shdescription
变更历史
- PostgreSQL 9.5
- 列
description被设置为NOT NULL(提交 82a532b3)
- 列
- PostgreSQL 8.2
- 添加 (提交 f9a726aa)
示例
为 表空间添加注释
postgres=# COMMENT ON TABLESPACE tblspc_1 IS 'Store some of the things'; COMMENT postgres=# SELECT * FROM pg_shdescription WHERE objoid = (SELECT oid FROM pg_tablespace WHERE spcname = 'tblspc_1'); objoid | classoid | description --------+----------+-------------------------- 16385 | 1213 | Store some of the things (1 row)
也可以使用函数 shobj_description() 来检索表空间注释。
postgres=# SELECT shobj_description(
(SELECT oid FROM pg_tablespace WHERE spcname = 'tblspc_1'),
'pg_tablespace');
shobj_description
--------------------------
Store some of the things
(1 row)
从 表空间移除注释
postgres=# COMMENT ON TABLESPACE space_1 IS NULL; COMMENT postgres=# SELECT * FROM pg_shdescription WHERE objoid = (SELECT oid FROM pg_tablespace WHERE spcname = 'tblspc_1'); objoid | classoid | description --------+----------+------------- (0 rows)
参考资料
- PostgreSQL 文档: pg_shdescription
