pg_prepared_xacts
是一个提供有关当前为两阶段提交准备的事务的信息的系统目录视图。
pg_prepared_xacts
在PostgreSQL 8.1 中添加。
按 PostgreSQL 版本定义
pg_prepared_xacts (PostgreSQL 17)
View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | |
pg_prepared_xacts (PostgreSQL 16)
View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | |
pg_prepared_xacts (PostgreSQL 15)
View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | |
pg_prepared_xacts (PostgreSQL 14)
View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | |
pg_prepared_xacts (PostgreSQL 13)
View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | |
pg_prepared_xacts (PostgreSQL 12)
View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | |
pg_prepared_xacts (PostgreSQL 11)
View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | |
pg_prepared_xacts (PostgreSQL 10)
View "pg_catalog.pg_prepared_xacts" Column | Type | Collation | Nullable | Default -------------+--------------------------+-----------+----------+--------- transaction | xid | | | gid | text | | | prepared | timestamp with time zone | | | owner | name | | | database | name | | |
pg_prepared_xacts (PostgreSQL 9.6)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name |
pg_prepared_xacts (PostgreSQL 9.5)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name |
pg_prepared_xacts (PostgreSQL 9.4)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name |
pg_prepared_xacts (PostgreSQL 9.3)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name |
pg_prepared_xacts (PostgreSQL 9.2)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name |
pg_prepared_xacts (PostgreSQL 9.1)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name |
pg_prepared_xacts (PostgreSQL 9.0)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name |
pg_prepared_xacts (PostgreSQL 8.4)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name | View definition: SELECT p.transaction, p.gid, p.prepared, u.rolname AS owner, d.datname AS database FROM pg_prepared_xact() p(transaction, gid, prepared, ownerid, dbid) LEFT JOIN pg_authid u ON p.ownerid = u.oid LEFT JOIN pg_database d ON p.dbid = d.oid;
pg_prepared_xacts (PostgreSQL 8.3)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name | View definition: SELECT p.transaction, p.gid, p.prepared, u.rolname AS owner, d.datname AS database FROM pg_prepared_xact() p(transaction xid, gid text, prepared timestamp with time zone, ownerid oid, dbid oid) LEFT JOIN pg_authid u ON p.ownerid = u.oid LEFT JOIN pg_database d ON p.dbid = d.oid;
pg_prepared_xacts (PostgreSQL 8.2)
View "pg_catalog.pg_prepared_xacts" Column | Type | Modifiers -------------+--------------------------+----------- transaction | xid | gid | text | prepared | timestamp with time zone | owner | name | database | name | View definition: SELECT p."transaction", p.gid, p."prepared", u.rolname AS "owner", d.datname AS "database" FROM pg_prepared_xact() p("transaction" xid, gid text, "prepared" timestamp with time zone, ownerid oid, dbid oid) LEFT JOIN pg_authid u ON p.ownerid = u.oid LEFT JOIN pg_database d ON p.dbid = d.oid;
更改历史记录
- PostgreSQL 8.1
- 添加 (提交 d0a89683)
pg_prepared_xacts
自在PostgreSQL 8.1 中添加以来,没有进行修改。
示例
示例内容
postgres=# BEGIN; BEGIN postgres=*# PREPARE TRANSACTION 'foo'; PREPARE TRANSACTION postgres=# SELECT * FROM pg_prepared_xacts; transaction | gid | prepared | owner | database -------------+-----+-------------------------------+----------+---------- 721 | foo | 2021-09-07 10:49:32.784179+01 | postgres | postgres (1 row)
参考文献
- PostgreSQL 文档: pg_prepared_xacts