Re: patch to create system view that lists cursors - Mailing list pgsql-patches

From Neil Conway
Subject Re: patch to create system view that lists cursors
Date
Msg-id 1137105579.9143.159.camel@localhost.localdomain
Whole thread Raw
In response to patch to create system view that lists cursors  (Joachim Wieland <joe@mcknight.de>)
Responses Re: patch to create system view that lists cursors  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: patch to create system view that lists cursors  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
List pgsql-patches
On Thu, 2006-01-12 at 10:51 +0100, Joachim Wieland wrote:
> Attached is a patch to create a new system view pg_cursors to list all
> available cursors to the current session and transaction.

+ /* loop until we find a named portal or hit the end of the list */
+ while ((hentry = hash_seq_search(hash_seq)) != NULL)
+ {
+     portal = hentry->portal;
+     /* there can be a named portal created by CreateNewPortal, its
name
+      * will be "<unnamed portal n>" (see CreateNewPortal function in
this
+      * file). Those have a status of PORTAL_NEW. The status of cursors
is
+      * PORTAL_READY however. */
+     if (portal->status != PORTAL_READY)
+         continue;
+     if (portal->name[0] != '\0')
+         break;
+ }

I think it is worth distinguishing more clearly between portals that
should be displayed to the user and those that should not (which might
be labelled "internal cursors", perhaps). The tests above seem fairly
ad-hoc.

Barring any objections, I'll implement the above and apply the revised
patch tomorrow.

-Neil



pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: mbutils.c memory cxt cleanup
Next
From: Tom Lane
Date:
Subject: Re: patch to create system view that lists cursors