]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Add extension_state member to PlannedStmt.
authorRobert Haas <rhaas@postgresql.org>
Wed, 8 Oct 2025 13:07:49 +0000 (09:07 -0400)
committerRobert Haas <rhaas@postgresql.org>
Wed, 8 Oct 2025 13:07:49 +0000 (09:07 -0400)
Extensions can stash data computed at plan time into this list using
planner_shutdown_hook (or perhaps other mechanisms) and then access
it from any code that has access to the PlannedStmt (such as explain
hooks), allowing for extensible debugging and instrumentation of
plans.

Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoYWKHU2hKr62Toyzh-kTDEnMDeLw7gkOOnjL-TnOUq0kQ@mail.gmail.com

src/include/nodes/plannodes.h

index 3d196f5078e1c9a2ed2668d44350d632a2ae081f..77ec2bc10b292814228c03ce68bdfec989d7e7a6 100644 (file)
@@ -149,6 +149,15 @@ typedef struct PlannedStmt
        /* non-null if this is utility stmt */
        Node       *utilityStmt;
 
+       /*
+        * DefElem objects added by extensions, e.g. using planner_shutdown_hook
+        *
+        * Set each DefElem's defname to the name of the plugin or extension, and
+        * the argument to a tree of nodes that all have copy and read/write
+        * support.
+        */
+       List       *extension_state;
+
        /* statement location in source string (copied from Query) */
        /* start location, or -1 if unknown */
        ParseLoc        stmt_location;