summaryrefslogtreecommitdiff
path: root/src/include/utils/portal.h
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2006-01-18 06:49:30 +0000
committerNeil Conway <neilc@samurai.com>2006-01-18 06:49:30 +0000
commit33e06ebccbc21677be6dbc112e3d150bd13b17cb (patch)
treeb55b21dfeefca076512b2cc8f597eace12f3eeb4 /src/include/utils/portal.h
parent558bc2584d7e79801acb8344b79838cd3511915b (diff)
Add a new system view, pg_cursors, that displays the currently available
cursors. Patch from Joachim Wieland, review and ediorialization by Neil Conway. The view lists cursors defined by DECLARE CURSOR, using SPI, or via the Bind message of the frontend/backend protocol. This means the view does not list the unnamed portal or the portal created to implement EXECUTE. Because we do list SPI portals, there might be more rows in this view than you might expect if you are using SPI implicitly (e.g. via a procedural language). Per recent discussion on -hackers, the query string included in the view for cursors defined by DECLARE CURSOR is based on debug_query_string. That means it is not accurate if multiple queries separated by semicolons are submitted as one query string. However, there doesn't seem a trivial fix for that: debug_query_string is better than nothing. I also changed SPI_cursor_open() to include the source text for the portal it creates: AFAICS there is no reason not to do this. Update the documentation and regression tests, bump the catversion.
Diffstat (limited to 'src/include/utils/portal.h')
-rw-r--r--src/include/utils/portal.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h
index 758592525ff..dca2ce8af3e 100644
--- a/src/include/utils/portal.h
+++ b/src/include/utils/portal.h
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.57 2005/10/15 02:49:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.58 2006/01/18 06:49:29 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,7 +72,6 @@
* PORTAL_MULTI_QUERY: all other cases. Here, we do not support partial
* execution: the portal's queries will be run to completion on first call.
*/
-
typedef enum PortalStrategy
{
PORTAL_ONE_SELECT,
@@ -166,6 +165,10 @@ typedef struct PortalData
bool atEnd;
bool posOverflow;
long portalPos;
+
+ /* Presentation data, primarily used by the pg_cursors system view */
+ TimestampTz creation_time; /* time at which this portal was defined */
+ bool visible; /* include this portal in pg_cursors? */
} PortalData;
/*