Re: Extend injection_points_attach() to accept a user-defined function - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Extend injection_points_attach() to accept a user-defined function
Date
Msg-id aQDGFZCnYMTaEEuH@paquier.xyz
Whole thread Raw
In response to Extend injection_points_attach() to accept a user-defined function  (Rahila Syed <rahilasyed90@gmail.com>)
List pgsql-hackers
On Tue, Oct 28, 2025 at 06:11:25PM +0530, Rahila Syed wrote:
> I would like to propose providing a sql interface to link a
> user-defined function to an injection point.
> Currently, if a user wants an injection point to invoke a custom
> function, they must first define an SQL
> function that attaches the injection point to the target/custom
> function. This SQL function can then be called
> in sql tests to attach to the injection point before running the tests.
> The attached patch simplifies this by extending the
> injection_points_attach() function to support a new
> action type called "func".

@@ -354,6 +354,7 @@ injection_points_attach(PG_FUNCTION_ARGS)
+    char       *mod_name;
[...]
@@ -362,6 +363,15 @@ injection_points_attach(PG_FUNCTION_ARGS)
         function = "injection_notice";
     else if (strcmp(action, "wait") == 0)
         function = "injection_wait";
+    else if (strcmp(action, "func") == 0)

How about a simpler injection_points_attach(point_name text, func
text, module text) with a second SQL function, but a different number
of arguments?   Using a new hardcoded action for this purpose is
confusing as your point is to introduce a SQL wrapper on top of
InjectionPointAttach(), and using input arguments that match with the
C function is an attractive option.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Maxime Schoemans
Date:
Subject: Re: [PATCH] Check that index can return in get_actual_variable_range()
Next
From: Amit Langote
Date:
Subject: Re: Batching in executor