Simon Willison’s Weblog

Subscribe

Wednesday, 9th March 2022

Postgres Auditing in 150 lines of SQL (via) I’ve run up against the problem of tracking changes made to rows within a database table so many times, and I still don’t have a preferred solution. This approach to it looks very neat: it uses PostgreSQL triggers to populate a single audit table (as opposed to one audit table per tracked table) and records the previous and current column values for the row using jsonb.

# 7:19 pm / postgresql, databases

2022 » March

MTWTFSS
 123456
78910111213
14151617181920
21222324252627
28293031