在psql中,如果我做了\d+,我会得到以下内容
Schema | Name | Type | Owner | Size | Description
--------+-------------------------+----------+--------+------------+-------------
norsar | Routing Result | table | morten | 16 kB |
norsar | Routing Result_id_seq | sequence | morten | 8192 bytes | 诸若此类。最后一个字段“描述”总是空白的。该字段在哪里读取其内容?-因此,我如何在表上设置描述?在某些情况下,这是非常有用的--如果我执行\d+ <tablename>,在列上显示的描述也是一样的。
我试过\set ECHO_HIDDEN ON,但这并没有让它变得更清楚。
发布于 2019-03-22 08:34:58
它显示了使用命令comment on定义的注释:
下表定义:
create table foo
(
id integer primary key,
name text not null
);
comment on table foo is 'This is the famous foo table';
comment on column foo.id is 'This is the primary key';
comment on column foo.name is 'This is the name of the thing';然后就会像这样出现:
postgres> \d+
List of relations
Schema | Name | Type | Owner | Size | Description
--------+-----------+-------+--------+------------+------------------------------
public | foo | table | thomas | 8192 bytes | This is the famous foo table
(1 row)
postgres> \d+ foo
Table "public.foo"
Column | Type | Collation | Nullable | Default | Storage | Stats target | Description
--------+---------+-----------+----------+---------+----------+--------------+-------------------------------
id | integer | | not null | | plain | | This is the primary key
name | text | | not null | | extended | | This is the name of the thing
Indexes:
"foo_pkey" PRIMARY KEY, btree (id)
postgres>https://dba.stackexchange.com/questions/232826
复制相似问题