| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Rahila Syed <rahilasyed90(at)gmail(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Extend injection_points_attach() to accept a user-defined function |
| Date: | 2025-10-28 13:33:09 |
| Message-ID: | aQDGFZCnYMTaEEuH@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Langote | 2025-10-28 13:40:48 | Re: Batching in executor |
| Previous Message | Maxime Schoemans | 2025-10-28 13:28:30 | Re: [PATCH] Check that index can return in get_actual_variable_range() |