CustomExec

From PostgreSQL wiki

Contents

Brief Idea

The purpose of ExecNodeExtender allows extensions to replace a part of Plan node in PlannedStmt by the self defined node type, and run it as if built-in executor nodes. It enables a cutting-edge but not upstreamed feature to implement its own query execution instead of the standard one, without branching whole of the source code.

This idea tries to adds a new plan node type (ExtendExec) that is associated with several callback functions to be implemented in extension module.
Existing planner_hook is a good strategic point to adjust the PlannedStmt being constructed by standard planner. Once an extension inject an ExtendExec node into the Plan tree underlying PlannedStmt, related callback shall be invoked on several points, therefore, extension can implement its own logic as a part of regular executor.