summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2025-09-15 10:48:30 +0200
committerPeter Eisentraut <peter@eisentraut.org>2025-09-15 11:04:10 +0200
commit70407d39b7ea8fd41496489b5f6a30c285e7d7d0 (patch)
tree28d5953d89105b1caa19f7cff9554e49a1fa6f0d /src
parent1e3b5edb8eb236f16529ca8dae917996ad1f433e (diff)
Improve ExplainState type handling in header files
Now that we can have repeat typedefs with C11, we don't need to use "struct ExplainState" anymore but can instead make a typedef where necessary. This doesn't change anything but makes it look nicer. (There are more opportunities for similar changes, but this is broken out because there was a separate discussion about it, and it's somewhat bulky on its own.) Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/f36c0a45-98cd-40b2-a7cc-f2bf02b12890%40eisentraut.org#a12fb1a2c1089d6d03010f6268871b00 Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org
Diffstat (limited to 'src')
-rw-r--r--src/include/commands/explain.h24
-rw-r--r--src/include/commands/explain_dr.h5
-rw-r--r--src/include/commands/explain_format.h37
-rw-r--r--src/include/commands/explain_state.h2
-rw-r--r--src/include/foreign/fdwapi.h10
5 files changed, 40 insertions, 38 deletions
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
index 3b122f79ed8..6e51d50efc7 100644
--- a/src/include/commands/explain.h
+++ b/src/include/commands/explain.h
@@ -16,13 +16,13 @@
#include "executor/executor.h"
#include "parser/parse_node.h"
-struct ExplainState; /* defined in explain_state.h */
+typedef struct ExplainState ExplainState; /* defined in explain_state.h */
/* Hook for plugins to get control in ExplainOneQuery() */
typedef void (*ExplainOneQuery_hook_type) (Query *query,
int cursorOptions,
IntoClause *into,
- struct ExplainState *es,
+ ExplainState *es,
const char *queryString,
ParamListInfo params,
QueryEnvironment *queryEnv);
@@ -31,7 +31,7 @@ extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
/* Hook for EXPLAIN plugins to print extra information for each plan */
typedef void (*explain_per_plan_hook_type) (PlannedStmt *plannedstmt,
IntoClause *into,
- struct ExplainState *es,
+ ExplainState *es,
const char *queryString,
ParamListInfo params,
QueryEnvironment *queryEnv);
@@ -42,7 +42,7 @@ typedef void (*explain_per_node_hook_type) (PlanState *planstate,
List *ancestors,
const char *relationship,
const char *plan_name,
- struct ExplainState *es);
+ ExplainState *es);
extern PGDLLIMPORT explain_per_node_hook_type explain_per_node_hook;
/* Hook for plugins to get control in explain_get_index_name() */
@@ -53,32 +53,32 @@ extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
ParamListInfo params, DestReceiver *dest);
extern void standard_ExplainOneQuery(Query *query, int cursorOptions,
- IntoClause *into, struct ExplainState *es,
+ IntoClause *into, ExplainState *es,
const char *queryString, ParamListInfo params,
QueryEnvironment *queryEnv);
extern TupleDesc ExplainResultDesc(ExplainStmt *stmt);
extern void ExplainOneUtility(Node *utilityStmt, IntoClause *into,
- struct ExplainState *es, ParseState *pstate,
+ ExplainState *es, ParseState *pstate,
ParamListInfo params);
extern void ExplainOnePlan(PlannedStmt *plannedstmt, IntoClause *into,
- struct ExplainState *es, const char *queryString,
+ ExplainState *es, const char *queryString,
ParamListInfo params, QueryEnvironment *queryEnv,
const instr_time *planduration,
const BufferUsage *bufusage,
const MemoryContextCounters *mem_counters);
-extern void ExplainPrintPlan(struct ExplainState *es, QueryDesc *queryDesc);
-extern void ExplainPrintTriggers(struct ExplainState *es,
+extern void ExplainPrintPlan(ExplainState *es, QueryDesc *queryDesc);
+extern void ExplainPrintTriggers(ExplainState *es,
QueryDesc *queryDesc);
-extern void ExplainPrintJITSummary(struct ExplainState *es,
+extern void ExplainPrintJITSummary(ExplainState *es,
QueryDesc *queryDesc);
-extern void ExplainQueryText(struct ExplainState *es, QueryDesc *queryDesc);
-extern void ExplainQueryParameters(struct ExplainState *es,
+extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
+extern void ExplainQueryParameters(ExplainState *es,
ParamListInfo params, int maxlen);
#endif /* EXPLAIN_H */
diff --git a/src/include/commands/explain_dr.h b/src/include/commands/explain_dr.h
index 55da63d66bd..b62f1f8542c 100644
--- a/src/include/commands/explain_dr.h
+++ b/src/include/commands/explain_dr.h
@@ -16,7 +16,8 @@
#include "executor/instrument.h"
#include "tcop/dest.h"
-struct ExplainState; /* avoid including explain.h here */
+/* avoid including explain_state.h here */
+typedef struct ExplainState ExplainState;
/* Instrumentation data for EXPLAIN's SERIALIZE option */
typedef struct SerializeMetrics
@@ -26,7 +27,7 @@ typedef struct SerializeMetrics
BufferUsage bufferUsage; /* buffers accessed during serialization */
} SerializeMetrics;
-extern DestReceiver *CreateExplainSerializeDestReceiver(struct ExplainState *es);
+extern DestReceiver *CreateExplainSerializeDestReceiver(ExplainState *es);
extern SerializeMetrics GetSerializationMetrics(DestReceiver *dest);
#endif
diff --git a/src/include/commands/explain_format.h b/src/include/commands/explain_format.h
index 05045bf8cb4..f849a3938ce 100644
--- a/src/include/commands/explain_format.h
+++ b/src/include/commands/explain_format.h
@@ -15,44 +15,45 @@
#include "nodes/pg_list.h"
-struct ExplainState; /* avoid including explain.h here */
+/* avoid including explain_state.h here */
+typedef struct ExplainState ExplainState;
extern void ExplainPropertyList(const char *qlabel, List *data,
- struct ExplainState *es);
+ ExplainState *es);
extern void ExplainPropertyListNested(const char *qlabel, List *data,
- struct ExplainState *es);
+ ExplainState *es);
extern void ExplainPropertyText(const char *qlabel, const char *value,
- struct ExplainState *es);
+ ExplainState *es);
extern void ExplainPropertyInteger(const char *qlabel, const char *unit,
- int64 value, struct ExplainState *es);
+ int64 value, ExplainState *es);
extern void ExplainPropertyUInteger(const char *qlabel, const char *unit,
- uint64 value, struct ExplainState *es);
+ uint64 value, ExplainState *es);
extern void ExplainPropertyFloat(const char *qlabel, const char *unit,
double value, int ndigits,
- struct ExplainState *es);
+ ExplainState *es);
extern void ExplainPropertyBool(const char *qlabel, bool value,
- struct ExplainState *es);
+ ExplainState *es);
extern void ExplainOpenGroup(const char *objtype, const char *labelname,
- bool labeled, struct ExplainState *es);
+ bool labeled, ExplainState *es);
extern void ExplainCloseGroup(const char *objtype, const char *labelname,
- bool labeled, struct ExplainState *es);
+ bool labeled, ExplainState *es);
extern void ExplainOpenSetAsideGroup(const char *objtype, const char *labelname,
bool labeled, int depth,
- struct ExplainState *es);
-extern void ExplainSaveGroup(struct ExplainState *es, int depth,
+ ExplainState *es);
+extern void ExplainSaveGroup(ExplainState *es, int depth,
int *state_save);
-extern void ExplainRestoreGroup(struct ExplainState *es, int depth,
+extern void ExplainRestoreGroup(ExplainState *es, int depth,
int *state_save);
extern void ExplainDummyGroup(const char *objtype, const char *labelname,
- struct ExplainState *es);
+ ExplainState *es);
-extern void ExplainBeginOutput(struct ExplainState *es);
-extern void ExplainEndOutput(struct ExplainState *es);
-extern void ExplainSeparatePlans(struct ExplainState *es);
+extern void ExplainBeginOutput(ExplainState *es);
+extern void ExplainEndOutput(ExplainState *es);
+extern void ExplainSeparatePlans(ExplainState *es);
-extern void ExplainIndentText(struct ExplainState *es);
+extern void ExplainIndentText(ExplainState *es);
#endif
diff --git a/src/include/commands/explain_state.h b/src/include/commands/explain_state.h
index 32728f5d1a1..ba073b86918 100644
--- a/src/include/commands/explain_state.h
+++ b/src/include/commands/explain_state.h
@@ -79,7 +79,7 @@ typedef struct ExplainState
typedef void (*ExplainOptionHandler) (ExplainState *, DefElem *, ParseState *);
/* Hook to perform additional EXPLAIN options validation */
-typedef void (*explain_validate_options_hook_type) (struct ExplainState *es, List *options,
+typedef void (*explain_validate_options_hook_type) (ExplainState *es, List *options,
ParseState *pstate);
extern PGDLLIMPORT explain_validate_options_hook_type explain_validate_options_hook;
diff --git a/src/include/foreign/fdwapi.h b/src/include/foreign/fdwapi.h
index b4da4e6a16a..fcd7e7027f3 100644
--- a/src/include/foreign/fdwapi.h
+++ b/src/include/foreign/fdwapi.h
@@ -16,8 +16,8 @@
#include "nodes/execnodes.h"
#include "nodes/pathnodes.h"
-/* To avoid including explain.h here, reference ExplainState thus: */
-struct ExplainState;
+/* avoid including explain_state.h here */
+typedef struct ExplainState ExplainState;
/*
@@ -137,16 +137,16 @@ typedef void (*RefetchForeignRow_function) (EState *estate,
bool *updated);
typedef void (*ExplainForeignScan_function) (ForeignScanState *node,
- struct ExplainState *es);
+ ExplainState *es);
typedef void (*ExplainForeignModify_function) (ModifyTableState *mtstate,
ResultRelInfo *rinfo,
List *fdw_private,
int subplan_index,
- struct ExplainState *es);
+ ExplainState *es);
typedef void (*ExplainDirectModify_function) (ForeignScanState *node,
- struct ExplainState *es);
+ ExplainState *es);
typedef int (*AcquireSampleRowsFunc) (Relation relation, int elevel,
HeapTuple *rows, int targrows,