johndunlap / pgauditor

Create audit trails in PostgreSQL
Other
0 stars 0 forks source link

Support full row capture on update #13

Open johndunlap opened 1 year ago

johndunlap commented 1 year ago

At present, updates are only captured when the data actually changes. However, in sooner use cases it may be preferable to capture all columns in an update instead of only those columns that changed.

johndunlap commented 1 year ago

This has been implemented but it needs a rethink so I'm leaving it open for now. The result of it is that all values which were not updated are stored in the audit table twice. This is very space inefficient. We may need to switch to, or at least support, versioned audit tables with a single column for each column in the source table. This would have the added advantage of allowing tables with very large numbers of columns to be audited. With the current approach, the audit table has more than double the columns of the source table.

johndunlap commented 1 year ago

I rolled back this change because it is very inefficient. I will re-address this issue later when a better design is available.

johndunlap commented 7 months ago

The command line flags for this should accept "row" or "column". In column mode, the new/old values are captured on the same row. In row mode, the row is persisted verbatim in the audit table.