Re: New feature request for adding session information to PostgreSQL transaction log

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sumanth Vishwaraj <sumanth(dot)vishwaraj(at)oracle(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Mahesh Rao <mahesh(dot)p(dot)rao(at)oracle(dot)com>, Nazia Zaidi <najiah(dot)abide(at)oracle(dot)com>, Jitesh Tiwari <jitesh(dot)tiwari(at)oracle(dot)com>, Nick Wagner <nick(dot)wagner(at)oracle(dot)com>, Scott Corbin <scott(dot)corbin(at)oracle(dot)com>, Mack Bell <mack(dot)bell(at)oracle(dot)com>, Avinash Dubey <avinash(dot)x(dot)dubey(at)oracle(dot)com>
Subject: Re: New feature request for adding session information to PostgreSQL transaction log
Date: 2025-01-19 17:02:05
Message-ID: 2741541.1737306125@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Sumanth Vishwaraj <sumanth(dot)vishwaraj(at)oracle(dot)com> 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-01-19 18:10:43 Re: Old BufferDesc refcount in PrintBufferDescs and PrintPinnedBufs
Previous Message Tomas Vondra 2025-01-19 15:50:49 Re: Parallel heap vacuum