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 ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match