News for hackers. Stuff that matters.
Re:Postgres Auditing in 150 lines of SQL by oliverrice on Wednesday March 09, 2022 @04:26PM (#30620197)
if `user_id` is in the table you're auditing you could do

``` alter table audit.record_version add column user_id bigint default (coalesce(record, old_record) ->> 'user_id'); ```

or if you meant the SQL `current_user` you could extend the trigger to track it.

but if the user_id is only available in application space (not in the db) it will not be possible using straight SQL

There are no comments on this comment yet.