pgpool2.git / summary / log / commit / refs
commit d768944b2a320e51cd2c3bc8dfbe6607a2306a46
Author: Peng Bo <pengbo@localhost.localdomain>
Commit: Tatsuo Ishii <ishii@postgresql.org>
Date: Fri Aug 26 07:05:14 2016 +0000
import PostgreSQL 9.6 parser
src/include/parser/explain.h | 101 ++++++++++++++++++++++++++++++++++++++++
src/include/parser/extensible.h | 86 ++++++++++++++++++++++++++++++++++
2 files changed, 187 insertions(+)
diff --git a/src/include/parser/explain.h b/src/include/parser/explain.h
new file mode 100644
index 000000000..dc8d8c5e7
--- /dev/null
+++ b/src/include/parser/explain.h
@@ -0,0 +1,101 @@
+/*-------------------------------------------------------------------------
+ *
+ * explain.h
+ * prototypes for explain.c
+ *
+ * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994-5, Regents of the University of California
+ *
+ * src/include/commands/explain.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef EXPLAIN_H
+#define EXPLAIN_H
+
+//#include "executor/executor.h"
+//#include "lib/stringinfo.h"
+
+typedef enum ExplainFormat
+{
+ EXPLAIN_FORMAT_TEXT,
+ EXPLAIN_FORMAT_XML,
+ EXPLAIN_FORMAT_JSON,
+ EXPLAIN_FORMAT_YAML
+} ExplainFormat;
+
+typedef struct ExplainState
+{
+ StringInfo str; /* output buffer */
+ /* options */
+ bool verbose; /* be verbose */
+ bool analyze; /* print actual times */
+ bool costs; /* print estimated costs */
+ bool buffers; /* print buffer usage */
+ bool timing; /* print detailed node timing */
+ bool summary; /* print total planning and execution timing */
+ ExplainFormat format; /* output format */
+ /* state for output formatting --- not reset for each new plan tree */
+ int indent; /* current indentation level */
+ List *grouping_stack; /* format-specific grouping state */
+ /* state related to the current plan tree (filled by ExplainPrintPlan) */
+ PlannedStmt *pstmt; /* top of plan */
+ List *rtable; /* range table */
+ List *rtable_names; /* alias names for RTEs */
+ List *deparse_cxt; /* context list for deparsing expressions */
+ Bitmapset *printed_subplans; /* ids of SubPlans we've printed */
+} ExplainState;
+
+/* Hook for plugins to get control in ExplainOneQuery() */
+typedef void (*ExplainOneQuery_hook_type) (Query *query,
+ IntoClause *into,
+ ExplainState *es,
+ const char *queryString,
+ ParamListInfo params);
+extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
+
+/* Hook for plugins to get control in explain_get_index_name() */
+typedef const char *(*explain_get_index_name_hook_type) (Oid indexId);
+extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
+
+
+extern void ExplainQuery(ExplainStmt *stmt, const char *queryString,
+ ParamListInfo params, DestReceiver *dest);
+
+extern ExplainState *NewExplainState(void);
+
+extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
+
+extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
+ ExplainState *es,
+ const char *queryString, ParamListInfo params);
+
+extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
+ ExplainState *es, const char *queryString,
+ ParamListInfo params, const instr_time *planduration);
+
+extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
+extern void ExplainPrintTriggers(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);
+
+extern void ExplainPropertyList(const char *qlabel, List *data,
+ ExplainState *es);
+extern void ExplainPropertyListNested(const char *qlabel, List *data,
+ ExplainState *es);
+extern void ExplainPropertyText(const char *qlabel, const char *value,
+ ExplainState *es);
+extern void ExplainPropertyInteger(const char *qlabel, int value,
+ ExplainState *es);
+extern void ExplainPropertyLong(const char *qlabel, long value,
+ ExplainState *es);
+extern void ExplainPropertyFloat(const char *qlabel, double value, int ndigits,
+ ExplainState *es);
+extern void ExplainPropertyBool(const char *qlabel, bool value,
+ ExplainState *es);
+
+#endif /* EXPLAIN_H */
diff --git a/src/include/parser/extensible.h b/src/include/parser/extensible.h
new file mode 100644
index 000000000..eac16de51
--- /dev/null
+++ b/src/include/parser/extensible.h
@@ -0,0 +1,86 @@
+/*-------------------------------------------------------------------------
+ *
+ * extensible.h
+ * Definitions for extensible nodes and custom scans
+ *
+ *
+ * Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * src/include/nodes/extensible.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef EXTENSIBLE_H
+#define EXTENSIBLE_H
+
+//#include "parallel.h"
+//#include "explain.h"
+//#include "nodes/execnodes.h"
+//#include "nodes/plannodes.h"
+//#include "nodes/relation.h"
+
+/* maximum length of an extensible node identifier */
+#define EXTNODENAME_MAX_LEN 64
+
+/*
+ * An extensible node is a new type of node defined by an extension. The
+ * type is always T_ExtensibleNode, while the extnodename identifies the
+ * specific type of node. extnodename can be looked up to find the
+ * ExtensibleNodeMethods for this node type.
+ */
+typedef struct ExtensibleNode
+{
+ NodeTag type;
+ const char *extnodename; /* identifier of ExtensibleNodeMethods */
+} ExtensibleNode;
+
+/*
+ * node_size is the size of an extensible node of this type in bytes.
+ *
+ * nodeCopy is a function which performs a deep copy from oldnode to newnode.
+ * It does not need to copy type or extnodename, which are copied by the
+ * core system.
+ *
+ * nodeEqual is a function which performs a deep equality comparison between
+ * a and b and returns true or false accordingly. It does not need to compare
+ * type or extnodename, which are compared by the core system.
+ *
+ * nodeOut is a serialization function for the node type. It should use the
+ * output conventions typical for outfuncs.c. It does not need to output
+ * type or extnodename; the core system handles those.
+ *
+ * nodeRead is a deserialization function for the node type. It does not need
+ * to read type or extnodename; the core system handles those. It should fetch
+ * the next token using pg_strtok() from the current input stream, and then
+ * reconstruct the private fields according to the manner in readfuncs.c.
+ *
+ * All callbacks are mandatory.
+ */
+typedef struct ExtensibleNodeMethods
+{
+ const char *extnodename;
+ Size node_size;
+ void (*nodeCopy) (struct ExtensibleNode *newnode,
+ const struct ExtensibleNode *oldnode);
+ bool (*nodeEqual) (const struct ExtensibleNode *a,
+ const struct ExtensibleNode *b);
+ void (*nodeOut) (struct StringInfoData *str,
+ const struct ExtensibleNode *node);
+ void (*nodeRead) (struct ExtensibleNode *node);
+} ExtensibleNodeMethods;
+
+extern void RegisterExtensibleNodeMethods(const ExtensibleNodeMethods *method);
+extern const ExtensibleNodeMethods *GetExtensibleNodeMethods(const char *name,
+ bool missing_ok);
+
+/*
+ * Flags for custom paths, indicating what capabilities the resulting scan
+ * will have.
+ */
+#define CUSTOMPATH_SUPPORT_BACKWARD_SCAN 0x0001
+#define CUSTOMPATH_SUPPORT_MARK_RESTORE 0x0002
+
+
+
+#endif /* EXTENSIBLE_H */
[parent: c0eb0ee5d23e]