On Fri, Aug 21, 2026 at 11:42 AM Pavlo Golub <[email protected]> wrote:
>
> The function returns NULL during recovery or when no valid VXID exists.


On a standby the function actually returns the VXID just fine -- the
code only guards on MyProc/procNumber, which is the same condition %v
uses, and StartTransaction assigns the vxid unconditionally during
recovery (no RecoveryInProgress guard anywhere). We should change
the commit message.

Example:
SELECT pg_is_in_recovery();
 pg_is_in_recovery
-------------------
 t

SELECT pg_current_vxact_id();
 pg_current_vxact_id
---------------------
 2/3


On the use case: I first thought monitoring recovery conflicts might be a
good example, but we can already do that with the PID. The cancelled query
already logged PID plus timestamp.

The only thing a VXID gives you over a PID is telling
multiple transactions within the same backend/session, and I haven't
been able to come up with a concrete case where you'd actually need that.

Does anyone have one?

Thanks,
Shihao


Reply via email to