↑↓ select ↵ open ⌫ change scope Open full search

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

Wiki / Plan Nodes / Extensibility

Custom Scan

CustomScan

Executes a plan supplied by a custom-scan provider.

Reading PostgreSQL 18.6.

Description

Executes a plan supplied by a custom-scan provider.

Core node tag
T_CustomScan
Structured EXPLAIN Node Type
Custom Scan
Inputs
Provider-defined plan, possibly with children
Output
Provider-defined tuples
Executor initializer
ExecInitCustomScan
Memory mechanism
unclassified

EXPLAIN names and attributes

Structured formats use the Node Type above. Text-format spellings can also include operation, strategy, join type, scan direction or aggregation-stage attributes.

Text names recorded by this source: Custom Scan (%s).

Parallel-aware and parallel-safe are different plan properties. A node running inside a parallel worker is not necessarily a parallel-aware node.

Memory and temporary storage

This extraction does not assign a universal memory limit or spill policy to this node. Inspect the same-build implementation and its expressions or provider.

Parallel execution and instrumentation

The source callbacks below can coordinate execution or collect worker instrumentation. Their presence is not a blanket claim that this node supports a shared parallel scan or shared state.

Callbacks in this build: ExecCustomScanEstimate, ExecCustomScanInitializeDSM, ExecCustomScanInitializeWorker, ExecCustomScanReInitializeDSM.

Executor implementation notes

nodeCustom.c Routines to handle execution of custom scan node

Allocate the CustomScanState object. We let the custom scan provider do the palloc, in case it wants to make a larger object that embeds CustomScanState as the first field. It must set the node tag and the methods field correctly at this time. Other standard fields should be set to zero.

Use a custom slot if specified in CustomScanState or use virtual slot otherwise.

Determine the scan tuple type. If the custom scan provider provided a targetlist describing the scan tuples, use that; else use base relation's rowtype.

The callback of custom-scan provider applies the final initialization of the custom-scan-state node according to its logic.

EXPLAIN identity in core source

case T_CustomScan:
			sname = "Custom Scan";
			custom_name = ((CustomScan *) plan)->methods->CustomName;
			if (custom_name)
				pname = psprintf("Custom Scan (%s)", custom_name);
			else
				pname = sname;
			break;

EXPLAIN labels in this source build

Text-format labelStructured node identity
Custom Scan (%s)Custom Scan

Related entries

Documentation and source

Source build
Version
18.6
Build
PostgreSQL 18.6 source archive
Source fingerprint
555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f

Compare versions

PostgreSQL 17 → 18: unchanged.

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 Plan Nodes · Recorded in PostgreSQL 10 through 20; the first sample is not necessarily its introduction.