1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +03:00

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".

Also per Tom, CreateExplainSerializeDestReceiver was still defined
in explain.h in addition to explain_dr.h. Remove leftover prototype.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoYtaad3i21V0jqua-fbr+CR0ix6uBvEX8_s6BG96abd=g@mail.gmail.com
This commit is contained in:
Robert Haas
2025-02-28 13:17:29 -05:00
parent 51d3e279c3
commit 77cb08be51
5 changed files with 30 additions and 23 deletions

View File

@@ -13,6 +13,7 @@
*/ */
#include "postgres.h" #include "postgres.h"
#include "commands/explain.h"
#include "commands/explain_dr.h" #include "commands/explain_dr.h"
#include "libpq/pqformat.h" #include "libpq/pqformat.h"
#include "libpq/protocol.h" #include "libpq/protocol.h"

View File

@@ -33,7 +33,7 @@
#include "access/xact.h" #include "access/xact.h"
#include "commands/copy.h" #include "commands/copy.h"
#include "commands/createas.h" #include "commands/createas.h"
#include "commands/explain.h" #include "commands/explain_dr.h"
#include "commands/matview.h" #include "commands/matview.h"
#include "executor/functions.h" #include "executor/functions.h"
#include "executor/tqueue.h" #include "executor/tqueue.h"

View File

@@ -120,6 +120,4 @@ extern void ExplainPrintJITSummary(ExplainState *es, QueryDesc *queryDesc);
extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc); extern void ExplainQueryText(ExplainState *es, QueryDesc *queryDesc);
extern void ExplainQueryParameters(ExplainState *es, ParamListInfo params, int maxlen); extern void ExplainQueryParameters(ExplainState *es, ParamListInfo params, int maxlen);
extern DestReceiver *CreateExplainSerializeDestReceiver(ExplainState *es);
#endif /* EXPLAIN_H */ #endif /* EXPLAIN_H */

View File

@@ -13,8 +13,10 @@
#ifndef EXPLAIN_DR_H #ifndef EXPLAIN_DR_H
#define EXPLAIN_DR_H #define EXPLAIN_DR_H
#include "commands/explain.h"
#include "executor/instrument.h" #include "executor/instrument.h"
#include "tcop/dest.h"
struct ExplainState; /* avoid including explain.h here */
/* Instrumentation data for EXPLAIN's SERIALIZE option */ /* Instrumentation data for EXPLAIN's SERIALIZE option */
typedef struct SerializeMetrics typedef struct SerializeMetrics
@@ -24,7 +26,7 @@ typedef struct SerializeMetrics
BufferUsage bufferUsage; /* buffers accessed during serialization */ BufferUsage bufferUsage; /* buffers accessed during serialization */
} SerializeMetrics; } SerializeMetrics;
extern DestReceiver *CreateExplainSerializeDestReceiver(ExplainState *es); extern DestReceiver *CreateExplainSerializeDestReceiver(struct ExplainState *es);
extern SerializeMetrics GetSerializationMetrics(DestReceiver *dest); extern SerializeMetrics GetSerializationMetrics(DestReceiver *dest);
#endif #endif

View File

@@ -13,40 +13,46 @@
#ifndef EXPLAIN_FORMAT_H #ifndef EXPLAIN_FORMAT_H
#define 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, extern void ExplainPropertyList(const char *qlabel, List *data,
ExplainState *es); struct ExplainState *es);
extern void ExplainPropertyListNested(const char *qlabel, List *data, extern void ExplainPropertyListNested(const char *qlabel, List *data,
ExplainState *es); struct ExplainState *es);
extern void ExplainPropertyText(const char *qlabel, const char *value, extern void ExplainPropertyText(const char *qlabel, const char *value,
ExplainState *es); struct ExplainState *es);
extern void ExplainPropertyInteger(const char *qlabel, const char *unit, 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, 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, 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, extern void ExplainPropertyBool(const char *qlabel, bool value,
ExplainState *es); struct ExplainState *es);
extern void ExplainOpenGroup(const char *objtype, const char *labelname, 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, 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, extern void ExplainOpenSetAsideGroup(const char *objtype, const char *labelname,
bool labeled, int depth, ExplainState *es); bool labeled, int depth,
extern void ExplainSaveGroup(ExplainState *es, int depth, int *state_save); struct ExplainState *es);
extern void ExplainRestoreGroup(ExplainState *es, int depth, int *state_save); 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, extern void ExplainDummyGroup(const char *objtype, const char *labelname,
ExplainState *es); struct ExplainState *es);
extern void ExplainBeginOutput(ExplainState *es); extern void ExplainBeginOutput(struct ExplainState *es);
extern void ExplainEndOutput(ExplainState *es); extern void ExplainEndOutput(struct ExplainState *es);
extern void ExplainSeparatePlans(ExplainState *es); extern void ExplainSeparatePlans(struct ExplainState *es);
extern void ExplainIndentText(ExplainState *es); extern void ExplainIndentText(struct ExplainState *es);
#endif #endif