历史版本。 PostgreSQL 9.2 已结束支持。 2017-11-09. 请参阅 当前版本手册.
45.55. pg_cursors #
该pg_cursors视图列出当前可用的游标。游标可以通过几种方式定义:
通过SQL中的DECLARE语句
通过前端/后端协议中的Bind消息,如第 46.2.3 节中所述
通过服务器编程接口(SPI),如第 43.1 节中所述
该pg_cursors视图会显示通过上述任意方式创建的游标。游标仅在定义它的事务持续期间存在,除非将其声明为WITH HOLD。因此,不可保持的游标只会在此视图中保留到创建它的事务结束为止。
注意
游标在内部用于实现PostgreSQL的某些组件,如过程语言。因此,pg_cursors视图可能包含用户未明确创建的游标。
表 45.56. pg_cursors 列
| Name | Type | Description |
|---|---|---|
name | text | The name of the cursor |
statement | text | The verbatim query string submitted to declare this cursor |
is_holdable | boolean | 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 | boolean | true if the cursor was declared
BINARY; false
otherwise
|
is_scrollable | boolean | 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视图是只读的。