Hi Tom, Our customers prefer "in product" solution instead of trigger-based solution due to the overheads and risks associated with triggers on their Production systems.
Oracle already provides the user session information in the redo/transaction logs. We have created a feature request, and Microsoft is also implementing the feature to add session information to the SQL Server CDC tables. We have a similar feature request for MySQL as well, to add session info to the MySQL binlog. Since the session info is mandated by MCA ( Ministry of Corporate Affairs India) regulations, we would also request PostgreSQL to populate the user session info in the redo/transaction log of PostgreSQL DB. Warm regards, Sumanth Vishwaraj ________________________________ From: Tom Lane <[email protected]> Sent: Sunday, January 19, 2025 10:32 PM To: Sumanth Vishwaraj <[email protected]> Cc: [email protected] <[email protected]>; Mahesh Rao <[email protected]>; Nazia Zaidi <[email protected]>; Jitesh Tiwari <[email protected]>; Nick Wagner <[email protected]>; Scott Corbin <[email protected]>; Mack Bell <[email protected]>; Avinash Dubey <[email protected]> Subject: [External] : Re: New feature request for adding session information to PostgreSQL transaction log Sumanth Vishwaraj <[email protected]> writes: > We would like PostgreSQL to store the details of who made the change > (user/session) information in the transaction log. You can build that yourself, typically by adding a trigger that stores the value of "current_user" into inserted/updated rows. (If you want to also track deletions, a separate audit log table would work better.) The event-trigger feature might also be useful. It's unlikely that we'd consider implementing such functionality at a lower level, because these sorts of requirements always come with an array of application-specific details about what is to be logged. It would be impractical to satisfy all such cases in one implementation. There would also be concerns about imposing overhead on users who have no need for such a feature. regards, tom lane
