From: lessardjm (@lessardjm) <noreply+lessardjm@github.com>
To: pgaudit/pgaudit <noreply+pgaudit-pgaudit@github.com>
Subject: [pgaudit/pgaudit] issue #288: Improvement - Put TRUNCATE in a separate audit class
Date: Thu, 28 Aug 2025 15:47:50 +0000
Message-ID: <gh-pgaudit-pgaudit-288@github.com> (raw)
When auditing by objects using pgaudit.role to limit the number of table audited, truncates are not audited.
To audit truncates we need to audit writes on all tables (pgaudit.log=writes).
Let say you have a logging table like an audit, history, etc., table that is always updated when a table is modified (insert/update/delete).
For example
- A table that logs changes performed by the application (application auditing) at the business objects level.
- A hash table for inter - RDBMS platform replication that contains the hash of a business object (one hash by row of a parent table + child rows and grand-child rows).
Configuring the audit for writes in all tables (pgaudit.log=writes) can easily double log file sizes or more.
Configuring the audit for writes of only application tables (exclude secondary writes to audit, history, etc, tables) will not audit truncates.
Most of the time, truncates are rare, but important to audit.
Adding a new classes of audited statements (pgaudit.log=truncate) would be a nice feature in such cases.
pgaudit.log=writes may still include truncates for backward compatibility.