52.69. pg\_cursors

|    52.69. `pg_cursors`    |                   |                           |                  |                                   |
|:-------------------------:|-------------------|---------------------------|------------------|-----------------------------------|
|[Prev](view-pg-config.html)|[Up](catalogs.html)|Chapter 52. System Catalogs|[Home](index.html)| [Next](view-pg-file-settings.html)|

---

## 52.69. `pg_cursors`

[]()

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

* via the [`DECLARE`](sql-declare.html) statement in SQL

* via the Bind message in the frontend/backend protocol, as described in [Section 53.2.3](protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY)

* via the Server Programming Interface (SPI), as described in [Section 47.1](spi-interface.html)

 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

 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 52.70. `pg_cursors` Columns**

|                                                                      Column Type<br/><br/> Description                                                                     |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|                                                               `name` `text`<br/><br/> The name of the cursor                                                               |
|                                          `statement` `text`<br/><br/> The verbatim query string submitted to declare this cursor                                           |
|`is_holdable` `bool`<br/><br/>`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`<br/><br/>`true` if the cursor was declared `BINARY`; `false` otherwise                                          |
|         `is_scrollable` `bool`<br/><br/>`true` if the cursor is scrollable (that is, it allows rows to be retrieved in a nonsequential manner); `false` otherwise          |
|                                             `creation_time` `timestamptz`<br/><br/> The time at which the cursor was declared                                              |

 The `pg_cursors` view is read-only.

---

|[Prev](view-pg-config.html)|[Up](catalogs.html)| [Next](view-pg-file-settings.html)|
|:--------------------------|:-----------------:|----------------------------------:|
|    52.68. `pg_config`     |[Home](index.html) |     52.70. `pg_file_settings`     |

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>