From 31539b45328dd99dce9eb955df2990125b79d0bd Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Thu, 27 Feb 2025 16:23:11 -0500 Subject: [PATCH v2] Avoid including explain.h in explain_format.h and explain_dr.h As per a suggestion from Tom Lane, we do this by declaring "struct ExplainState" here and refer to that rather than "ExplainState". --- src/backend/commands/explain_dr.c | 1 + src/include/commands/explain_dr.h | 6 ++-- src/include/commands/explain_format.h | 42 +++++++++++++++------------ 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/src/backend/commands/explain_dr.c b/src/backend/commands/explain_dr.c index a0a37ea70f4..fb42bee6e72 100644 --- a/src/backend/commands/explain_dr.c +++ b/src/backend/commands/explain_dr.c @@ -13,6 +13,7 @@ */ #include "postgres.h" +#include "commands/explain.h" #include "commands/explain_dr.h" #include "libpq/pqformat.h" #include "libpq/protocol.h" diff --git a/src/include/commands/explain_dr.h b/src/include/commands/explain_dr.h index 8f86239b41e..55da63d66bd 100644 --- a/src/include/commands/explain_dr.h +++ b/src/include/commands/explain_dr.h @@ -13,8 +13,10 @@ #ifndef EXPLAIN_DR_H #define EXPLAIN_DR_H -#include "commands/explain.h" #include "executor/instrument.h" +#include "tcop/dest.h" + +struct ExplainState; /* avoid including explain.h here */ /* Instrumentation data for EXPLAIN's SERIALIZE option */ typedef struct SerializeMetrics @@ -24,7 +26,7 @@ typedef struct SerializeMetrics BufferUsage bufferUsage; /* buffers accessed during serialization */ } SerializeMetrics; -extern DestReceiver *CreateExplainSerializeDestReceiver(ExplainState *es); +extern DestReceiver *CreateExplainSerializeDestReceiver(struct 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 0460f0fd2af..05045bf8cb4 100644 --- a/src/include/commands/explain_format.h +++ b/src/include/commands/explain_format.h @@ -13,40 +13,46 @@ #ifndef EXPLAIN_FORMAT_H #define EXPLAIN_FORMAT_H -#include "commands/explain.h" +#include "nodes/pg_list.h" + +struct ExplainState; /* avoid including explain.h here */ extern void ExplainPropertyList(const char *qlabel, List *data, - ExplainState *es); + struct ExplainState *es); extern void ExplainPropertyListNested(const char *qlabel, List *data, - ExplainState *es); + struct ExplainState *es); extern void ExplainPropertyText(const char *qlabel, const char *value, - ExplainState *es); + struct ExplainState *es); extern void ExplainPropertyInteger(const char *qlabel, const char *unit, - int64 value, ExplainState *es); + int64 value, struct ExplainState *es); extern void ExplainPropertyUInteger(const char *qlabel, const char *unit, - uint64 value, ExplainState *es); + uint64 value, struct ExplainState *es); extern void ExplainPropertyFloat(const char *qlabel, const char *unit, - double value, int ndigits, ExplainState *es); + double value, int ndigits, + struct ExplainState *es); extern void ExplainPropertyBool(const char *qlabel, bool value, - ExplainState *es); + struct ExplainState *es); extern void ExplainOpenGroup(const char *objtype, const char *labelname, - bool labeled, ExplainState *es); + bool labeled, struct ExplainState *es); extern void ExplainCloseGroup(const char *objtype, const char *labelname, - bool labeled, ExplainState *es); + bool labeled, struct ExplainState *es); extern void ExplainOpenSetAsideGroup(const char *objtype, const char *labelname, - bool labeled, int depth, ExplainState *es); -extern void ExplainSaveGroup(ExplainState *es, int depth, int *state_save); -extern void ExplainRestoreGroup(ExplainState *es, int depth, int *state_save); + bool labeled, int depth, + struct ExplainState *es); +extern void ExplainSaveGroup(struct ExplainState *es, int depth, + int *state_save); +extern void ExplainRestoreGroup(struct ExplainState *es, int depth, + int *state_save); extern void ExplainDummyGroup(const char *objtype, const char *labelname, - ExplainState *es); + struct ExplainState *es); -extern void ExplainBeginOutput(ExplainState *es); -extern void ExplainEndOutput(ExplainState *es); -extern void ExplainSeparatePlans(ExplainState *es); +extern void ExplainBeginOutput(struct ExplainState *es); +extern void ExplainEndOutput(struct ExplainState *es); +extern void ExplainSeparatePlans(struct ExplainState *es); -extern void ExplainIndentText(ExplainState *es); +extern void ExplainIndentText(struct ExplainState *es); #endif -- 2.39.3 (Apple Git-145)