Re: Add pg_get_injection_points() for information of injection points - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Add pg_get_injection_points() for information of injection points
Date
Msg-id aAcXw0nhnavUy4v_@paquier.xyz
Whole thread Raw
In response to Re: Add pg_get_injection_points() for information of injection points  (Rahila Syed <rahilasyed90@gmail.com>)
List pgsql-hackers
On Tue, Apr 15, 2025 at 04:37:51PM +0530, Rahila Syed wrote:
> The function actually retrieves an array not a list, so the comment and
> the function name may be misleading.
> This function not only retrieves an array of injection points but also
> the number of injection points. Would it be more efficient to define a
> single
> struct that includes both the array of injection points and the number of
> points?
> This way, both values can be returned from the function.

Right, I was wondering a bit what to do here.  And I've come down to
the conclusion to just make this API return a List.

> Would it be useful to put the logic of the above function under #define
> USE_INJECTION_POINT.  This approach would make it possible to
> distinguish between cases where no injection points are attached and
> instances where the build does not support injection points.

For this one, I've found that InjectionPointList() was the incorrect
bit: we can make it issue an elog(ERROR) if !USE_INJECTION_POINTS.
This way, none of its callers will be confused between the case of a
NIL List meaning either !USE_INJECTION_POINTS or that there are no
points attached if the build uses USE_INJECTION_POINTS.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: doc patch: clarify the naming rule for injection_points
Next
From: jian he
Date:
Subject: Re: bug: virtual generated column can be partition key