SELECT
table_catalog, table_schema, table_name, table_type
FROM
information_schema.tables
WHERE
table_schema IN ('pg_catalog', 'information_schema');
结果:
table_catalog | table_schema | table_name | table_type
---------------+--------------------+---------------------------------------+------------
test | pg_catalog | pg_statistic | BASE TABLE
test | pg_catalog | pg_type | BASE TABLE
test | pg_catalog | pg_foreign_table | BASE TABLE
test | pg_catalog | pg_authid | BASE TABLE
test | pg_catalog | pg_shadow | VIEW
test | pg_catalog | pg_statistic_ext_data | BASE TABLE
test | pg_catalog | pg_roles | VIEW
test | pg_catalog | pg_settings | VIEW
test | pg_catalog | pg_file_settings | VIEW
...
...
...
和information_schema(其中绝大多数是VIEWs):
test | information_schema | information_schema_catalog_name | VIEW
test | information_schema | attributes | VIEW
test | information_schema | applicable_roles | VIEW
test | information_schema | administrable_role_authorizations | VIEW
test | information_schema | check_constraint_routine_usage | VIEW
test | information_schema | character_sets | VIEW
test | information_schema | check_constraints | VIEW
...
...
...
请注意,表的确切数量和/或名称将因版本而异(略有不同)。
和information_schema架构
test | information_schema | information_schema_catalog_name | VIEW
test | information_schema | attributes | VIEW
test | information_schema | applicable_roles | VIEW
test | information_schema | administrable_role_authorizations | VIEW
test | information_schema | check_constraint_routine_usage | VIEW
test | information_schema | character_sets | VIEW
test | information_schema | check_constraints | VIEW
...
...
...
这些将出现在全新安装中。您还可以使用“纯” psql:
\dt+
结果:
List of relations
Schema | Name | Type | Owner
------------+-------------------------+-------+-------
pg_catalog | pg_aggregate | table | pol
pg_catalog | pg_am | table | pol
pg_catalog | pg_amop | table | pol
...
...
...
然后,对于VIEWs:
\dv+
结果:
List of relations
Schema | Name | Type | Owner
------------+---------------------------------+------+-------
pg_catalog | pg_available_extension_versions | view | pol
pg_catalog | pg_available_extensions | view | pol
pg_catalog | pg_backend_memory_contexts | view | pol
pg_catalog | pg_config | view | pol
...
...
...
psql
您可以使用该实用程序(或您选择的工具)找到这一点。有关 pgAdmin 4 的操作方法,请参阅答案末尾。运行以下 SQL(此代码也适用于此处的小提琴):
结果:
和
information_schema
(其中绝大多数是VIEW
s):请注意,表的确切数量和/或名称将因版本而异(略有不同)。
和
information_schema
架构这些将出现在全新安装中。您还可以使用“纯”
psql
:结果:
然后,对于
VIEW
s:结果:
这也适用于
information_schema
. 如上所述,您还应该能够使用您选择的工具来完成此操作 - 例如,这是使用pgAdmin 4的方法- 您可以将系统目录表设置为默认可见或不可见(我发现它们使接口 - 仅在必要时打开)。