COMMENT ON

用于操作对象注释的SQL命令

COMMENT ON 是一个用于定义、修改或删除对象注释的DDL命令。

COMMENT ON 添加于 PostgreSQL 7.0

支持函数

以下系统函数提供了SQL级别的支持,用于提取对象注释

更改历史

示例

为表添加注释

postgres=# COMMENT ON TABLE foo IS 'Store all the things';
COMMENT

postgres=# \dt+ foo
                                        List of relations
 Schema | Name | Type  |  Owner   | Persistence | Access Method |  Size   |     Description      
--------+------+-------+----------+-------------+---------------+---------+----------------------
 public | foo  | table | postgres | permanent   | heap          | 0 bytes | Store all the things
(1 row)

修改表注释

postgres=# COMMENT ON TABLE foo IS 'Store most of the things';
COMMENT

postgres=# \dt+ foo
                                          List of relations
 Schema | Name | Type  |  Owner   | Persistence | Access Method |  Size   |       Description        
--------+------+-------+----------+-------------+---------------+---------+--------------------------
 public | foo  | table | postgres | permanent   | heap          | 0 bytes | Store most of the things
(1 row)

从表中删除注释

postgres=# COMMENT ON TABLE foo IS NULL;
COMMENT

postgres=# \dt+ foo
                                   List of relations
 Schema | Name | Type  |  Owner   | Persistence | Access Method |  Size   | Description 
--------+------+-------+----------+-------------+---------------+---------+-------------
 public | foo  | table | postgres | permanent   | heap          | 0 bytes | 
(1 row)

分类

DDLSQL命令

参见

pg_descriptionpg_shdescription

反馈

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