pg_shdescription

一个系统表,记录共享数据库对象的注释

pg_shdescription 是一个 系统目录 表,记录共享数据库对象的注释

pg_shdescriptionPostgreSQL 8.2 中添加。

此表在群集中的所有数据库之间共享。

按 PostgreSQL 版本定义

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

更改历史记录

示例

表空间 添加注释

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)

分类

集群范围表DDL系统目录

另请参阅

pg_descriptionpg_shdependCOMMENT ONshobj_description()

反馈

提交任何关于 "pg_shdescription" 的评论、建议或更正 此处