pg_cursors

列出当前可用游标的系统视图

pg_cursors 是一个 系统目录 视图,列出当前可用的游标。

pg_cursorsPostgreSQL 8.2 中添加。

按 PostgreSQL 版本定义

pg_cursors (PostgreSQL 17)

                       View "pg_catalog.pg_cursors"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 name          | text                     |           |          | 
 statement     | text                     |           |          | 
 is_holdable   | boolean                  |           |          | 
 is_binary     | boolean                  |           |          | 
 is_scrollable | boolean                  |           |          | 
 creation_time | timestamp with time zone |           |          |
    

文档: pg_cursors

pg_cursors (PostgreSQL 16)

                       View "pg_catalog.pg_cursors"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 name          | text                     |           |          | 
 statement     | text                     |           |          | 
 is_holdable   | boolean                  |           |          | 
 is_binary     | boolean                  |           |          | 
 is_scrollable | boolean                  |           |          | 
 creation_time | timestamp with time zone |           |          |
    

文档: pg_cursors

pg_cursors (PostgreSQL 15)

                       View "pg_catalog.pg_cursors"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 name          | text                     |           |          | 
 statement     | text                     |           |          | 
 is_holdable   | boolean                  |           |          | 
 is_binary     | boolean                  |           |          | 
 is_scrollable | boolean                  |           |          | 
 creation_time | timestamp with time zone |           |          |
    

文档: pg_cursors

pg_cursors (PostgreSQL 14)

                       View "pg_catalog.pg_cursors"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 name          | text                     |           |          | 
 statement     | text                     |           |          | 
 is_holdable   | boolean                  |           |          | 
 is_binary     | boolean                  |           |          | 
 is_scrollable | boolean                  |           |          | 
 creation_time | timestamp with time zone |           |          |
    

文档: pg_cursors

pg_cursors (PostgreSQL 13)

                       View "pg_catalog.pg_cursors"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 name          | text                     |           |          | 
 statement     | text                     |           |          | 
 is_holdable   | boolean                  |           |          | 
 is_binary     | boolean                  |           |          | 
 is_scrollable | boolean                  |           |          | 
 creation_time | timestamp with time zone |           |          |
    

文档: pg_cursors

pg_cursors (PostgreSQL 12)

                       View "pg_catalog.pg_cursors"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 name          | text                     |           |          | 
 statement     | text                     |           |          | 
 is_holdable   | boolean                  |           |          | 
 is_binary     | boolean                  |           |          | 
 is_scrollable | boolean                  |           |          | 
 creation_time | timestamp with time zone |           |          |
    

文档: pg_cursors

pg_cursors (PostgreSQL 11)

                       View "pg_catalog.pg_cursors"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 name          | text                     |           |          | 
 statement     | text                     |           |          | 
 is_holdable   | boolean                  |           |          | 
 is_binary     | boolean                  |           |          | 
 is_scrollable | boolean                  |           |          | 
 creation_time | timestamp with time zone |           |          |
    

文档: pg_cursors

pg_cursors (PostgreSQL 10)

                       View "pg_catalog.pg_cursors"
    Column     |           Type           | Collation | Nullable | Default 
---------------+--------------------------+-----------+----------+---------
 name          | text                     |           |          | 
 statement     | text                     |           |          | 
 is_holdable   | boolean                  |           |          | 
 is_binary     | boolean                  |           |          | 
 is_scrollable | boolean                  |           |          | 
 creation_time | timestamp with time zone |           |          |
    

文档: pg_cursors

pg_cursors (PostgreSQL 9.6)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone |
    

文档: pg_cursors

pg_cursors (PostgreSQL 9.5)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone |
    

文档: pg_cursors

pg_cursors (PostgreSQL 9.4)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone |
    

文档: pg_cursors

pg_cursors (PostgreSQL 9.3)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone |
    

文档: pg_cursors

pg_cursors (PostgreSQL 9.2)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone |
    

文档: pg_cursors

pg_cursors (PostgreSQL 9.1)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone |
    

文档: pg_cursors

pg_cursors (PostgreSQL 9.0)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone |
    

文档: pg_cursors

pg_cursors (PostgreSQL 8.4)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone | 
View definition:
 SELECT c.name, c.statement, c.is_holdable, c.is_binary, c.is_scrollable, c.creation_time
   FROM pg_cursor() c(name, statement, is_holdable, is_binary, is_scrollable, creation_time);
    

文档: pg_cursors

pg_cursors (PostgreSQL 8.3)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone | 
View definition:
 SELECT c.name, c.statement, c.is_holdable, c.is_binary, c.is_scrollable, c.creation_time
   FROM pg_cursor() c(name text, statement text, is_holdable boolean, is_binary boolean, is_scrollable boolean, creation_time timestamp with time zone);
    

文档: pg_cursors

pg_cursors (PostgreSQL 8.2)

             View "pg_catalog.pg_cursors"
    Column     |           Type           | Modifiers 
---------------+--------------------------+-----------
 name          | text                     | 
 statement     | text                     | 
 is_holdable   | boolean                  | 
 is_binary     | boolean                  | 
 is_scrollable | boolean                  | 
 creation_time | timestamp with time zone | 
View definition:
 SELECT c.name, c."statement", c.is_holdable, c.is_binary, c.is_scrollable, c.creation_time
   FROM pg_cursor() c(name text, "statement" text, is_holdable boolean, is_binary boolean, is_scrollable boolean, creation_time timestamp with time zone);
    

文档: pg_cursors

更改历史记录

PostgreSQL 8.2 中添加以来,此视图未被修改。

示例

postgres=# BEGIN;
BEGIN

postgres=*# DECLARE foo_cursor CURSOR
                FOR SELECT * FROM foo; 
DECLARE CURSOR

postgres=*# SELECT * FROM pg_cursors;
    name    |         statement          | is_holdable | is_binary | is_scrollable |        creation_time
------------+----------------------------+-------------+-----------+---------------+------------------------------
 foo_cursor | DECLARE foo_cursor CURSOR +| f           | f         | t             | 2022-10-25 08:04:54.64633+01
            |     FOR SELECT * FROM foo; |             |           |               |
(1 row)

postgres=*# CLOSE foo_cursor;
CLOSE CURSOR

postgres=*# SELECT * FROM pg_cursors;
 name | statement | is_holdable | is_binary | is_scrollable | creation_time
------+-----------+-------------+-----------+---------------+---------------
(0 rows)

分类

游标系统目录

另请参阅

DECLARECLOSE

反馈

提交任何关于 "pg_cursors" 的评论、建议或更正 此处