In core use of RegisterXactCallback() and RegisterSubXactCallback()

Bertrand Drouvot <bertranddrouvot.pg@gmail.com>

From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Amit Langote <amitlangote09@gmail.com>
Date: 2026-06-25T04:06:21Z
Lists: pgsql-hackers
Hi hackers,

while working on [1] I wanted to make use of RegisterSubXactCallback() and
realized that RegisterXactCallback() has this comment:

"
 * These functions are intended for use by dynamically loaded modules.
 * For built-in modules we generally just hardwire the appropriate calls
 * (mainly because it's easier to control the order that way, where needed).
"

So I thought of hardwiring the call directly in Start/Commit/AbortSubTransaction()
instead.

Then I realized that b7b27eb41a5 just made use of RegisterXactCallback() and
RegisterSubXactCallback(), so I'm wondering if it should hardwire the calls
instead?

Note that the other RegisterSubXactCallback() and RegisterXactCallback() look
legitimate to me (as in loadable modules).

[1]: https://www.postgresql.org/message-id/ajVD9TjerBLteNlx%40bdtpg

Regards,

-- 
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com



Commits

  1. Hardwire RI fast-path end-of-xact cleanup into xact.c