diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2010-02-16 22:19:59 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2010-02-16 22:19:59 +0000 |
commit | fc5173ad514a216dc93bc190dbba3751024a257d (patch) | |
tree | 6aef7769d8f91882752a786a03e894615274ebd8 /src | |
parent | 56adf3703c77295b63a71a42e602df247132e409 (diff) | |
download | postgresql-fc5173ad514a216dc93bc190dbba3751024a257d.tar.gz postgresql-fc5173ad514a216dc93bc190dbba3751024a257d.zip |
Add query text to auto_explain output.
Still to be done: fix docs and fix regression failures under auto_explain.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/commands/explain.c | 17 | ||||
-rw-r--r-- | src/include/commands/explain.h | 4 |
2 files changed, 19 insertions, 2 deletions
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 $ * *------------------------------------------------------------------------- */ @@ -488,6 +488,21 @@ ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc) } /* + * 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 */ diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index 6684ac52c81..6f39f7a5692 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.45 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.46 2010/02/16 22:19:59 adunstan Exp $ * *------------------------------------------------------------------------- */ @@ -66,6 +66,8 @@ extern void ExplainOnePlan(PlannedStmt *plannedstmt, ExplainState *es, extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc); +extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc); + extern void ExplainBeginOutput(ExplainState *es); extern void ExplainEndOutput(ExplainState *es); extern void ExplainSeparatePlans(ExplainState *es); |