{"kind": "hook", "major": "18", "item": {"slug": "planner_setup_hook", "name": "planner_setup_hook", "name_zh": "planner_setup_hook", "category": "Query planning", "summary": "Not recorded in the selected version.", "aliases": [], "versions": {"19": {"facts": [{"label": "Interface type", "value": "planner_setup_hook_type"}, {"label": "Header", "value": "src/include/optimizer/planner.h"}, {"label": "Subsystem", "value": "Query planning"}, {"label": "Initial value", "value": "NULL (no hook installed)"}], "related": [{"url": "/docs/19/planner-optimizer.html", "label": "The Planner/Optimizer"}], "release": {"ref": "REL_19_BETA4", "label": "19 Beta 4", "major": "19", "channel": "preview", "revision": "b73d13c32c834a2c8e1c60cb92f79530376cedf1"}, "sources": [{"url": "https://github.com/postgres/postgres/blob/b73d13c32c834a2c8e1c60cb92f79530376cedf1/src/include/optimizer/planner.h#L36", "path": "src/include/optimizer/planner.h", "label": "Interface declaration", "sha256": "4d38d7e4dd9956ef015711e8bf3262ea52631558a0eea290d4fa14ac517c5407"}, {"url": "https://github.com/postgres/postgres/blob/b73d13c32c834a2c8e1c60cb92f79530376cedf1/src/backend/optimizer/plan/planner.c#L77", "path": "src/backend/optimizer/plan/planner.c", "label": "Core definition", "sha256": "f71d959162a35db9df0f7b54c0fb7980fd61d80e8da24b1adae7c0dafb33b1c4"}, {"url": "https://github.com/postgres/postgres/blob/b73d13c32c834a2c8e1c60cb92f79530376cedf1/src/backend/optimizer/plan/planner.c#L538", "path": "src/backend/optimizer/plan/planner.c", "label": "Call sites", "sha256": "f71d959162a35db9df0f7b54c0fb7980fd61d80e8da24b1adae7c0dafb33b1c4"}], "sections": [{"title": "Core source comments", "paragraphs": ["Allow plugins to take control after we've initialized \"glob\""]}, {"title": "Call sites", "paragraphs": ["src/backend/optimizer/plan/planner.c:538"]}, {"code": "\t\tglob->default_pgs_mask |= PGS_GATHER_MERGE;\n\tif (enable_partitionwise_join)\n\t\tglob->default_pgs_mask |= PGS_CONSIDER_PARTITIONWISE;\n\n\t/* Allow plugins to take control after we've initialized \"glob\" */\n\tif (planner_setup_hook)\n\t\t(*planner_setup_hook) (glob, parse, query_string, cursorOptions,\n\t\t\t\t\t\t\t   &tuple_fraction, es);\n\n\t/* primary planning entry point (may recurse for subqueries) */\n\troot = subquery_planner(glob, parse, NULL, NULL, NULL, false,\n\t\t\t\t\t\t\ttuple_fraction, NULL);\n\n\t/* Select best Path and turn it into a Plan */\n\tfinal_rel = fetch_upper_rel(root, UPPERREL_FINAL, NULL);", "title": "Core call context: src/backend/optimizer/plan/planner.c:532\u2013546", "paragraphs": []}], "signature": "typedef void (*planner_setup_hook_type) (PlannerGlobal *glob, Query *parse, const char *query_string, int cursorOptions, double *tuple_fraction, ExplainState *es);\nextern PGDLLIMPORT planner_setup_hook_type planner_setup_hook;", "description": ["Hook for plugins to get control after PlannerGlobal is initialized"]}, "20": {"facts": [{"label": "Interface type", "value": "planner_setup_hook_type"}, {"label": "Header", "value": "src/include/optimizer/planner.h"}, {"label": "Subsystem", "value": "Query planning"}, {"label": "Initial value", "value": "NULL (no hook installed)"}], "related": [{"url": "/docs/devel/planner-optimizer.html", "label": "The Planner/Optimizer"}], "release": {"ref": "master", "label": "20 devel", "major": "20", "channel": "devel", "revision": "2c10c2ce4d7bcd57543a49ab402af02a39724e0a"}, "sources": [{"url": "https://github.com/postgres/postgres/blob/2c10c2ce4d7bcd57543a49ab402af02a39724e0a/src/include/optimizer/planner.h#L36", "path": "src/include/optimizer/planner.h", "label": "Interface declaration", "sha256": "4d38d7e4dd9956ef015711e8bf3262ea52631558a0eea290d4fa14ac517c5407"}, {"url": "https://github.com/postgres/postgres/blob/2c10c2ce4d7bcd57543a49ab402af02a39724e0a/src/backend/optimizer/plan/planner.c#L77", "path": "src/backend/optimizer/plan/planner.c", "label": "Core definition", "sha256": "fbcf53dca02672e0d1757d98942126dd22a4bcadf5a2323710f76d854fe84395"}, {"url": "https://github.com/postgres/postgres/blob/2c10c2ce4d7bcd57543a49ab402af02a39724e0a/src/backend/optimizer/plan/planner.c#L538", "path": "src/backend/optimizer/plan/planner.c", "label": "Call sites", "sha256": "fbcf53dca02672e0d1757d98942126dd22a4bcadf5a2323710f76d854fe84395"}], "sections": [{"title": "Core source comments", "paragraphs": ["Allow plugins to take control after we've initialized \"glob\""]}, {"title": "Call sites", "paragraphs": ["src/backend/optimizer/plan/planner.c:538"]}, {"code": "\t\tglob->default_pgs_mask |= PGS_GATHER_MERGE;\n\tif (enable_partitionwise_join)\n\t\tglob->default_pgs_mask |= PGS_CONSIDER_PARTITIONWISE;\n\n\t/* Allow plugins to take control after we've initialized \"glob\" */\n\tif (planner_setup_hook)\n\t\t(*planner_setup_hook) (glob, parse, query_string, cursorOptions,\n\t\t\t\t\t\t\t   &tuple_fraction, es);\n\n\t/* primary planning entry point (may recurse for subqueries) */\n\troot = subquery_planner(glob, parse, NULL, NULL, NULL, false,\n\t\t\t\t\t\t\ttuple_fraction, NULL);\n\n\t/* Select best Path and turn it into a Plan */\n\tfinal_rel = fetch_upper_rel(root, UPPERREL_FINAL, NULL);", "title": "Core call context: src/backend/optimizer/plan/planner.c:532\u2013546", "paragraphs": []}], "signature": "typedef void (*planner_setup_hook_type) (PlannerGlobal *glob, Query *parse, const char *query_string, int cursorOptions, double *tuple_fraction, ExplainState *es);\nextern PGDLLIMPORT planner_setup_hook_type planner_setup_hook;", "description": ["Hook for plugins to get control after PlannerGlobal is initialized"]}}, "content_hash": "cab5426487b6dceca93213414e8f43b9544e725224bbc52b6675f9ff9bdd61a3", "imported_at": "2026-09-27T09:57:58.882"}, "snapshot": null, "comparison": {"left": "17", "right": "18", "status": "unchanged", "diff": ""}}