pg_cursors

A system view listing the currently available cursors

pg_cursors is a system catalogue view listing the currently available cursors.

pg_cursors was added in PostgreSQL 8.2.

Definition by PostgreSQL version

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 |           |          |
    

Documentation: 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 |           |          |
    

Documentation: 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 |           |          |
    

Documentation: 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 |           |          |
    

Documentation: 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 |           |          |
    

Documentation: 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 |           |          |
    

Documentation: 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 |           |          |
    

Documentation: 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 |
    

Documentation: 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 |
    

Documentation: 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 |
    

Documentation: 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 |
    

Documentation: 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 |
    

Documentation: 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 |
    

Documentation: 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 |
    

Documentation: 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);
    

Documentation: 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);
    

Documentation: 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);
    

Documentation: pg_cursors

Change history

This view has not been modified since it was added in PostgreSQL 8.2.

Examples

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)

Categories

Cursors, System catalogue

See also

DECLARE, CLOSE