Allow a condition string in an injection point
Sami Imseih <samimseih@gmail.com>
From: Sami Imseih <samimseih@gmail.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Michael Paquier <michael@paquier.xyz>,
Masahiko Sawada <sawada.mshk@gmail.com>, Daniil Davydov <3danissimo@gmail.com>
Date: 2026-04-09T18:02:37Z
Lists: pgsql-hackers
Attachments
- v1-0001-Allow-a-condition-string-in-an-injection-point.patch (application/octet-stream) patch v1-0001
A follow-up to the discussion here [0], here is a patch that allows
for an arbitrary string in injection points to be able to apply more
granular filters for running an injection point. This will be useful
for autovacuum testing as discussed in the referenced thread,
and perhaps in some other places.
The string is capped at 256 bytes which seems like a reasonable
value. I considered using a flexible_array_member and to track
the length, but that hardly seemed worth it at this stage.
A case I envision, and there could be more is only run
the injection point for a specific rel.
```
SELECT injection_points_attach('my-inj-pt', 'wait', 'tab1');
```
```
#ifdef USE_INJECTION_POINTS
INJECTION_POINT("my-inj-pt", RelationGetRelationName(rel));
#endif
```
Worth noting, the condition types were changed to bit flags since
we may need to combine conditions such as local injection point
and string.
typedef enum InjectionPointConditionType
{
- INJ_CONDITION_ALWAYS = 0, /* always run */
- INJ_CONDITION_PID, /* PID restriction */
+ INJ_CONDITION_PID = 1 << 0, /* PID restriction */
+ INJ_CONDITION_STRING = 1 << 1, /* generic string match against arg */
} InjectionPointConditionType;
--
Sami
[0] https://www.postgresql.org/message-id/adWcVrX3jrHPoCmD%40paquier.xyz
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Zero-fill private_data when attaching an injection point
- 492c386b4df4 17.10 landed
- 35f41b29ff1d 18.4 landed
- 5b5bf51e4353 19 (unreleased) landed