↑↓ select ↵ open ⌫ change scope Open full search

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

Wiki / Hooks / Parsing and utility commands

ProcessUtility_hook

ProcessUtility_hook

Hook for plugins to get control in ProcessUtility()

Reading PostgreSQL 18.

Description

Hook for plugins to get control in ProcessUtility()

Interface type
ProcessUtility_hook_type
Header
src/include/tcop/utility.h
Subsystem
Parsing and utility commands
Initial value
NULL (no hook installed)

C interface

typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt, const char *queryString, bool readOnlyTree, ProcessUtilityContext context, ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest, QueryCompletion *qc);
extern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook;

Core source comments

We provide a function hook variable that lets loadable plugins get control when ProcessUtility is called. Such a plugin would normally call standard_ProcessUtility().

Call sites

src/backend/tcop/utility.c:519

Core call context: src/backend/tcop/utility.c:513–527

	/*
	 * We provide a function hook variable that lets loadable plugins get
	 * control when ProcessUtility is called.  Such a plugin would normally
	 * call standard_ProcessUtility().
	 */
	if (ProcessUtility_hook)
		(*ProcessUtility_hook) (pstmt, queryString, readOnlyTree,
								context, params, queryEnv,
								dest, qc);
	else
		standard_ProcessUtility(pstmt, queryString, readOnlyTree,
								context, params, queryEnv,
								dest, qc);
}

Documentation and source

Source build
Version
18
Build
REL_18_STABLE
Source fingerprint
753057e340da8f22e57c9a409ea7a235fd6a46bd

Compare versions

PostgreSQL 13 → 14: changed.

--- PostgreSQL 13
+++ PostgreSQL 14
@@ -17,6 +17,6 @@
       "value": "NULL (no hook installed)"
     }
   ],
-  "signature": "typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt, const char *queryString, ProcessUtilityContext context, ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest, QueryCompletion *qc);\nextern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook;",
+  "signature": "typedef void (*ProcessUtility_hook_type) (PlannedStmt *pstmt, const char *queryString, bool readOnlyTree, ProcessUtilityContext context, ParamListInfo params, QueryEnvironment *queryEnv, DestReceiver *dest, QueryCompletion *qc);\nextern PGDLLIMPORT ProcessUtility_hook_type ProcessUtility_hook;",
   "tables": null
 }

Compares recorded interfaces and attributes. Source fingerprints and build metadata are excluded; an absent sample is not proof of the introduction or removal release.

Related entries

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