在PostgreSQL中,COMMENT ON TABLE语句用于为数据库中的表添加或修改注释。这对于文档化数据库架构非常有用,可以帮助其他开发者或数据库管理员理解表的用途和内容。 1. 解释PostgreSQL中COMMENT ON TABLE语句的用途 COMMENT ON TABLE语句的主要用途是为表添加描述性信息,这些信息可以作为元数据存储在数据库中。这
COMMENT ON TABLE bills is '运单记录'; COMMENT ON COLUMN bills.id IS 'id号'; COMMENT ON COLUMN bills.goodsdesc IS '货物名称'; COMMENT ON COLUMN bills.beginunit IS '启运省份'; COMMENT ON COLUMN bills.begincity IS '启运城市'; COMMENT ON COLUMN bills.pubtime IS '发布时间'; COMMENT ON...
表的备注信息增加:commentontable '表名'is'备注信息'; 表的列名备注信息增加:commentontable '表名.列名'is'备注信息'; 表的列名备注信息查询:select*frompg_descriptionjoinpg_classonpg_description.objoid=pg_class.oidwhererelname='表名'
TABLESPACE pg_default;ALTERTABLEschema2023.some_info OWNERtopostgres; COMMENTONTABLEschema2023.some_infoIS'一些信息'; COMMENTONCOLUMNschema2023.some_info.idIS'主键'; COMMENTONCOLUMNschema2023.some_info.nameIS'名称'; COMMENTONCOLUMNschema2023.some_info.moneyIS'价值:人民币计价'; COMMENTONCOLUMNschema20...
where table_name like 'EMP%' --表注释 添加注释 comment on table 表名 is 注释comment on table emp is '员工表' comment on column 表名.列名 is 注释 comment on column emp.empno is '员工编号' --批量删除emp开头的表,除了emp drop table 表名;select 'drop table '||table_name||';' ...
表的备注信息增加:comment on table '表名' is '备注信息'; 表的列名备注信息增加:comment on table '表名.列名' is '备注信息'; 表的列名备注信息查询:select * from pg_description join pg_class on pg_description.objoid = pg_class.oid where relname = '表名'©...
由于commenttest是一个刚刚创建的新表,因此Description列为空。可以通过以下命令添加注释: postgres=# COMMENTONTABLE commenttestIS'A table of students in different departments';COMMENT AI代码助手复制代码 现在再次运行\d+,可以看到描述列填充了注释。
COMMENT定义或者改变一个对象的注释。COMMENT ON { TABLE object_name | COLUMN table_name.column_name | AGGREGATE agg_name (agg_type) | CAST (source_type AS target_type) | CONSTRAINT constraint_name ON table_name | CONVERSION object_name | DATABASE object_name | DOMAIN object_name | FUNCTION...
public|t_first_col_share|table|pgxz|16kB| public|tdsql_pg|table|pgxz|24kB|TDSQL PostgreSQL分布式关系型数据库系统 (3rows) postgres=# comment on column tdsql_pg.nickname is ' TDSQL PostgreSQL呢称是大象'; COMMENT postgres=# \d+ tdsql_pg ...
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE public.user TO mydata_dml; GRANT SELECT ON TABLE public.user TO mydata_qry; 删除账号 #撤回在public模式下的权限 revoke select on all tables in schema public from 用户名; #撤回在information_schema模式下的权限 ...