From fc5173ad514a216dc93bc190dbba3751024a257d Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Tue, 16 Feb 2010 22:19:59 +0000 Subject: Add query text to auto_explain output. Still to be done: fix docs and fix regression failures under auto_explain. --- src/backend/commands/explain.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/backend') diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 4195e2c6802..9100c404ad7 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994-5, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.202 2010/02/16 20:07:13 stark Exp $ + * $PostgreSQL: pgsql/src/backend/commands/explain.c,v 1.203 2010/02/16 22:19:59 adunstan Exp $ * *------------------------------------------------------------------------- */ @@ -487,6 +487,21 @@ ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc) NULL, NULL, NULL, es); } +/* + * ExplainQueryText - + * add a "Query Text" node that contains the actual text of the query + * + * The caller should have set up the options fields of *es, as well as + * initializing the output buffer es->str. + * + */ +void +ExplainQueryText(ExplainState *es, QueryDesc *queryDesc) +{ + if (queryDesc->sourceText) + ExplainPropertyText("Query Text", queryDesc->sourceText, es); +} + /* * report_triggers - * report execution stats for a single relation's triggers -- cgit v1.2.3