pg_extension
是一个包含有关扩展信息的系统目录表。
pg_extension
在PostgreSQL 9.1 中添加。
psql 命令
\dx
列出可用的扩展\dx+
列出每个扩展中的所有对象。
请注意,从PostgreSQL 13 开始,\dx+
不会显示对象是否被标记为配置关系(请参阅pg_extension_config_dump()
)。
依赖项
与扩展关联的对象会在pg_depend 中获得一个条目,其中deptype
设置为 'e
' (DEPENDENCY_EXTENSION
).
按 PostgreSQL 版本定义
pg_extension (PostgreSQL 17)
Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- oid | oid | | not null | extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | C | not null | extconfig | oid[] | | | extcondition | text[] | C | | Indexes: "pg_extension_oid_index" PRIMARY KEY, btree (oid) "pg_extension_name_index" UNIQUE CONSTRAINT, btree (extname)
文档: pg_extension
pg_extension (PostgreSQL 16)
Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- oid | oid | | not null | extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | C | not null | extconfig | oid[] | | | extcondition | text[] | C | | Indexes: "pg_extension_oid_index" PRIMARY KEY, btree (oid) "pg_extension_name_index" UNIQUE CONSTRAINT, btree (extname)
文档: pg_extension
pg_extension (PostgreSQL 15)
Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- oid | oid | | not null | extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | C | not null | extconfig | oid[] | | | extcondition | text[] | C | | Indexes: "pg_extension_oid_index" PRIMARY KEY, btree (oid) "pg_extension_name_index" UNIQUE CONSTRAINT, btree (extname)
文档: pg_extension
pg_extension (PostgreSQL 14)
Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- oid | oid | | not null | extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | C | not null | extconfig | oid[] | | | extcondition | text[] | C | | Indexes: "pg_extension_oid_index" PRIMARY KEY, btree (oid) "pg_extension_name_index" UNIQUE CONSTRAINT, btree (extname)
文档: pg_extension
pg_extension (PostgreSQL 13)
Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- oid | oid | | not null | extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | C | not null | extconfig | oid[] | | | extcondition | text[] | C | | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 12)
Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- oid | oid | | not null | extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | C | not null | extconfig | oid[] | | | extcondition | text[] | C | | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 11)
Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | | not null | extconfig | oid[] | | | extcondition | text[] | | | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 10)
Table "pg_catalog.pg_extension" Column | Type | Collation | Nullable | Default ----------------+---------+-----------+----------+--------- extname | name | | not null | extowner | oid | | not null | extnamespace | oid | | not null | extrelocatable | boolean | | not null | extversion | text | | not null | extconfig | oid[] | | | extcondition | text[] | | | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 9.6)
Table "pg_catalog.pg_extension" Column | Type | Modifiers ----------------+---------+----------- extname | name | not null extowner | oid | not null extnamespace | oid | not null extrelocatable | boolean | not null extversion | text | not null extconfig | oid[] | extcondition | text[] | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 9.5)
Table "pg_catalog.pg_extension" Column | Type | Modifiers ----------------+---------+----------- extname | name | not null extowner | oid | not null extnamespace | oid | not null extrelocatable | boolean | not null extversion | text | not null extconfig | oid[] | extcondition | text[] | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 9.4)
Table "pg_catalog.pg_extension" Column | Type | Modifiers ----------------+---------+----------- extname | name | not null extowner | oid | not null extnamespace | oid | not null extrelocatable | boolean | not null extversion | text | extconfig | oid[] | extcondition | text[] | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 9.3)
Table "pg_catalog.pg_extension" Column | Type | Modifiers ----------------+---------+----------- extname | name | not null extowner | oid | not null extnamespace | oid | not null extrelocatable | boolean | not null extversion | text | extconfig | oid[] | extcondition | text[] | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 9.2)
Table "pg_catalog.pg_extension" Column | Type | Modifiers ----------------+---------+----------- extname | name | not null extowner | oid | not null extnamespace | oid | not null extrelocatable | boolean | not null extversion | text | extconfig | oid[] | extcondition | text[] | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
pg_extension (PostgreSQL 9.1)
Table "pg_catalog.pg_extension" Column | Type | Modifiers ----------------+---------+----------- extname | name | not null extowner | oid | not null extnamespace | oid | not null extrelocatable | boolean | not null extversion | text | extconfig | oid[] | extcondition | text[] | Indexes: "pg_extension_name_index" UNIQUE, btree (extname) "pg_extension_oid_index" UNIQUE, btree (oid)
文档: pg_extension
更改历史记录
- PostgreSQL 9.5
- 列
extversion
设置为NOT NULL
(提交82a532b3)
- 列
- PostgreSQL 9.1
- 添加 (提交d9572c4e)
示例
postgres=# SELECT * FROM pg_extension; oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition -------+--------------------+----------+--------------+----------------+------------+-----------+-------------- 13579 | plpgsql | 10 | 11 | f | 1.0 | | 16455 | pg_stat_statements | 10 | 2200 | t | 1.7 | | (2 rows) postgres=# \dx List of installed extensions Name | Version | Schema | Description --------------------+---------+------------+----------------------------------------------------------- pg_stat_statements | 1.7 | public | track execution statistics of all SQL statements executed plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural language (2 rows) postgres=# \dx+ pg_stat_statements Objects in extension "pg_stat_statements" Object description --------------------------------------------------- function pg_stat_statements(boolean) function pg_stat_statements_reset(oid,oid,bigint) view pg_stat_statements (3 rows)
参考文献
- PostgreSQL 文档: pg_extension