Summary
The pg_cursors view lists the cursors that are currently available. Cursors can be defined in several ways: via the DECLARE statement in SQL
(Description quoted from the official PostgreSQL documentation.)
Columns
The pg_cursors system view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):
nametext
The name of the cursorstatementtext
The verbatim query string submitted to declare this cursoris_holdablebool
true if the cursor is holdable (that is, it can be accessed after the transaction that declared the cursor has committed); false otherwiseis_binarybool
true if the cursor was declared BINARY; false otherwiseis_scrollablebool
true if the cursor is scrollable (that is, it allows rows to be retrieved in a nonsequential manner); false otherwisecreation_timetimestamptz
The time at which the cursor was declared
Version applicability
Present in PostgreSQL 17, 18, 19 (verified against each release’s documentation). This is a long-standing system object that also exists in earlier PostgreSQL releases.
Related & references
Reference: PostgreSQL documentation — pg_cursors.