Re: Add pg_get_injection_points() for information of injection points

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Rahila Syed <rahilasyed90(at)gmail(dot)com>
Cc: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add pg_get_injection_points() for information of injection points
Date: 2025-04-22 04:14:59
Message-ID: aAcXw0nhnavUy4v_@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v4-0001-Add-InjectionPointList-to-retrieve-list-of-inject.patch text/x-diff 3.4 KB
v4-0002-Add-pg_get_injection_points.patch text/x-diff 9.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2025-04-22 05:48:26 Re: bug: virtual generated column can be partition key
Previous Message Hayato Kuroda (Fujitsu) 2025-04-22 04:02:21 RE: doc patch: clarify the naming rule for injection_points