Thread: BUG #2258: debug_print_plan doesn't work for cursors

BUG #2258: debug_print_plan doesn't work for cursors

From
"James Gray"
Date:
The following bug has been logged online:

Bug reference:      2258
Logged by:          James Gray
Email address:      jim.gray@bull.com
PostgreSQL version: 8.1.2
Operating system:   Linux/Windows
Description:        debug_print_plan doesn't work for cursors
Details:

Feature request: Allow debug_print_plan to produce log output for DECLARE
CURSOR statements (or on the first FETCH). The TODO FAQ does not list this
feature, nor does the mail archives discuss it. Looking at the Postgres
source for pg_plan_query() shows that DECLARE CURSOR is considered a utility
command, and currently does not produce log output for debug_print_plan.
However, EXPLAIN does allow a DECLARE CURSOR statement using a further
statement type check. We have a large customer/application with performance
problems related to a few of a large number of embedded cursors, and this
feature would help isolate the problem more rapidly. The cursors are all of
the type for which SPI_IS_CURSOR_PLAN would return TRUE.  We could do a
Postgres source change ourselves, but we are not sure that it is as simple
as adding: if (Debug_print_plan) elog_node_display(DEBUG1, "plan", plan,
debug_pretty_print)  after the call to planner() in the routine
PerformCursorOpen().