↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Documentation / Extension Hooks / EXPLAIN

ExplainOneQuery_hook

ExplainOneQuery_hook

Hook for plugins to get control in ExplainOneQuery()

Reading PostgreSQL 18.

Description

Hook for plugins to get control in ExplainOneQuery()

Interface type
ExplainOneQuery_hook_type
Header
src/include/commands/explain.h
Subsystem
EXPLAIN
Initial value
NULL (no hook installed)

C interface

typedef void (*ExplainOneQuery_hook_type) (Query *query, int cursorOptions, IntoClause *into, struct ExplainState *es, const char *queryString, ParamListInfo params, QueryEnvironment *queryEnv);
extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;

Core source comments

if an advisor plugin is present, let it manage things

Call sites

src/backend/commands/explain.c:306

Core call context: src/backend/commands/explain.c:300–314

		ExplainOneUtility(query->utilityStmt, into, es, pstate, params);
		return;
	}

	/* if an advisor plugin is present, let it manage things */
	if (ExplainOneQuery_hook)
		(*ExplainOneQuery_hook) (query, cursorOptions, into, es,
								 pstate->p_sourcetext, params, pstate->p_queryEnv);
	else
		standard_ExplainOneQuery(query, cursorOptions, into, es,
								 pstate->p_sourcetext, params, pstate->p_queryEnv);
}

/*
 * standard_ExplainOneQuery -

Related entries

Documentation and source

Source build
Version
18
Build
REL_18_STABLE
Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd

Related entries

Back to Extension Hooks · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.