显示PostgreSQL数据库模式

问题描述 投票:0回答:1

我想在PostgreSQL中显示类似的内容,但我不知道必须搜索什么

enter image description here

您能告诉我如何在PostgreSQL中显示类似的内容吗?

postgresql
1个回答
0
投票

您共享的图像是表格的图形布局。 PostgreSQL不会产生这样的输出,但是您可以通过在psql中运行\d <tablename>来获取单个表的布局。这将为您提供列,列类型,约束,主键,外键和注释的列表。

例如:

postgres=# \d catalogue
                               Table "public.catalogue"
   Column    |  Type   | Collation | Nullable |                Default
-------------+---------+-----------+----------+---------------------------------------
 id          | integer |           | not null | nextval('catalogue_id_seq'::regclass)
 item        | name    |           |          |
 qty         | integer |           |          |
 description | text    |           |          |
Indexes:
    "catalogue_pkey" PRIMARY KEY, btree (id)

或者,如果您需要基于GUI的解决方案,请签出PgAdmin:https://www.pgadmin.org/

© www.soinside.com 2019 - 2024. All rights reserved.