If you go the "audit table" path, just use "pgaudit" , it's a battle-tested extension, that is even available on RDS if you use AWS
https://github.com/pgaudit/pgaudit/blob/master/README.md
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appen...