Postgresql 中文操作指南

54.6. pg_cursors #

pg_cursors 视图会列出当前可用的游标。游标可以通过多种方式定义:

The pg_cursors view lists the cursors that are currently available. Cursors can be defined in several ways:

pg_cursors 视图会显示由这些方式创建的游标。除非游标已被声明为 WITH HOLD,否则游标仅在定义它们的交易期间存在。因此,不可保留游标只会在视图中存在到创建它们的交易结束时。

The pg_cursors view displays cursors created by any of these means. Cursors only exist for the duration of the transaction that defines them, unless they have been declared WITH HOLD. Therefore non-holdable cursors are only present in the view until the end of their creating transaction.

Note

游标在内部用于实现 PostgreSQL 的某些组件,例如过程语言。因此,pg_cursors 视图可能包括用户未明确创建的游标。

Cursors are used internally to implement some of the components of PostgreSQL, such as procedural languages. Therefore, the pg_cursors view might include cursors that have not been explicitly created by the user.

Table 54.6. pg_cursors Columns

Table 54.6. pg_cursors Columns

Column Type

Description

name text

The name of the cursor

statement text

The verbatim query string submitted to declare this cursor

is_holdable bool

true if the cursor is holdable (that is, it can be accessed after the transaction that declared the cursor has committed); false otherwise

is_binary bool

true if the cursor was declared BINARY; false otherwise

is_scrollable bool

true if the cursor is scrollable (that is, it allows rows to be retrieved in a nonsequential manner); false otherwise

creation_time timestamptz

The time at which the cursor was declared

pg_cursors 视图是只读的。

The pg_cursors view is read-only.