summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-08-10 05:46:50 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-08-10 05:46:50 +0000
commit9bd27b7c9e998087f390774bd0f43916813a2847 (patch)
treeee2b7fa2b2e77c53c87a53a786163dae1b0e6538 /src/include
parent18894c401f1f5ec5af1d08a12da1f183599e8560 (diff)
downloadpostgresql-9bd27b7c9e998087f390774bd0f43916813a2847.tar.gz
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
Diffstat (limited to 'src/include')
-rw-r--r--src/include/commands/explain.h16
-rw-r--r--src/include/utils/lsyscache.h3
-rw-r--r--src/include/utils/tuplesort.h7
-rw-r--r--src/include/utils/xml.h3
4 files changed, 23 insertions, 6 deletions
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 */
diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h
index 4428b22d59..28d768e7bf 100644
--- a/src/include/utils/lsyscache.h
+++ b/src/include/utils/lsyscache.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.128 2009/06/11 14:49:13 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/lsyscache.h,v 1.129 2009/08/10 05:46:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -76,6 +76,7 @@ extern Oid get_negator(Oid opno);
extern RegProcedure get_oprrest(Oid opno);
extern RegProcedure get_oprjoin(Oid opno);
extern char *get_func_name(Oid funcid);
+extern Oid get_func_namespace(Oid funcid);
extern Oid get_func_rettype(Oid funcid);
extern int get_func_nargs(Oid funcid);
extern Oid get_func_signature(Oid funcid, Oid **argtypes, int *nargs);
diff --git a/src/include/utils/tuplesort.h b/src/include/utils/tuplesort.h
index e351536d47..8504e2e9b3 100644
--- a/src/include/utils/tuplesort.h
+++ b/src/include/utils/tuplesort.h
@@ -13,7 +13,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/tuplesort.h,v 1.33 2009/06/11 14:49:13 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/tuplesort.h,v 1.34 2009/08/10 05:46:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -84,7 +84,10 @@ extern bool tuplesort_getdatum(Tuplesortstate *state, bool forward,
extern void tuplesort_end(Tuplesortstate *state);
-extern char *tuplesort_explain(Tuplesortstate *state);
+extern void tuplesort_get_stats(Tuplesortstate *state,
+ const char **sortMethod,
+ const char **spaceType,
+ long *spaceUsed);
extern int tuplesort_merge_order(long allowedMem);
diff --git a/src/include/utils/xml.h b/src/include/utils/xml.h
index b7d631c031..b7829a84de 100644
--- a/src/include/utils/xml.h
+++ b/src/include/utils/xml.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.28 2009/06/11 14:49:13 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/xml.h,v 1.29 2009/08/10 05:46:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,6 +70,7 @@ extern xmltype *xmlpi(char *target, text *arg, bool arg_is_null, bool *result_is
extern xmltype *xmlroot(xmltype *data, text *version, int standalone);
extern bool xml_is_document(xmltype *arg);
extern text *xmltotext_with_xmloption(xmltype *data, XmlOptionType xmloption_arg);
+extern char *escape_xml(const char *str);
extern char *map_sql_identifier_to_xml_name(char *ident, bool fully_escaped, bool escape_period);
extern char *map_xml_name_to_sql_identifier(char *name);