| From: | Sami Imseih <samimseih(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Daniil Davydov <3danissimo(at)gmail(dot)com> |
| Subject: | Allow a condition string in an injection point |
| Date: | 2026-04-09 18:02:37 |
| Message-ID: | CAA5RZ0tsGHu2h6YLnVu4HiK05q+gTE_9WVUAqihW2LSscAYS-g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Allow-a-condition-string-in-an-injection-point.patch | application/octet-stream | 11.2 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nathan Bossart | 2026-04-09 18:10:29 | Re: Add pg_stat_autovacuum_priority |
| Previous Message | Matheus Alcantara | 2026-04-09 18:00:34 | docs: Include database collation check on SQL from alter_collation.sgml |