From 9bd27b7c9e998087f390774bd0f43916813a2847 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 10 Aug 2009 05:46:50 +0000 Subject: Extend EXPLAIN to support output in XML or JSON format. There are probably still some adjustments to be made in the details of the output, but this gets the basic structure in place. Robert Haas --- src/include/commands/explain.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/include/commands/explain.h') diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h index a5cc40367f..fa2c8aac66 100644 --- a/src/include/commands/explain.h +++ b/src/include/commands/explain.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994-5, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.40 2009/07/26 23:34:18 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/explain.h,v 1.41 2009/08/10 05:46:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -15,16 +15,26 @@ #include "executor/executor.h" +typedef enum ExplainFormat +{ + EXPLAIN_FORMAT_TEXT, + EXPLAIN_FORMAT_XML, + EXPLAIN_FORMAT_JSON +} ExplainFormat; + typedef struct ExplainState { StringInfo str; /* output buffer */ /* options */ - bool verbose; /* print plan targetlists */ + bool verbose; /* be verbose */ bool analyze; /* print actual times */ bool costs; /* print costs */ + ExplainFormat format; /* output format */ /* other states */ PlannedStmt *pstmt; /* top of plan */ List *rtable; /* range table */ + int indent; /* current indentation level */ + List *grouping_stack; /* format-specific grouping state */ } ExplainState; /* Hook for plugins to get control in ExplainOneQuery() */ @@ -54,4 +64,6 @@ extern void ExplainOnePlan(PlannedStmt *plannedstmt, ExplainState *es, extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc); +extern void ExplainSeparatePlans(ExplainState *es); + #endif /* EXPLAIN_H */ -- cgit v1.2.1