Skip to content

Commit cc3bb4d

Browse files
authored
Merge pull request 2ndQuadrant#33 from AstunTechnology/master
Added a view showing all tables for which auditing has been set up
2 parents f67fbeb + a79d1b2 commit cc3bb4d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

audit.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,14 @@ $body$ LANGUAGE 'sql';
239239
COMMENT ON FUNCTION audit.audit_table(regclass) IS $body$
240240
Add auditing support to the given table. Row-level changes will be logged with full client query text. No cols are ignored.
241241
$body$;
242+
243+
CREATE OR REPLACE VIEW audit.tableslist AS
244+
SELECT DISTINCT triggers.trigger_schema AS schema,
245+
triggers.event_object_table AS auditedtable
246+
FROM information_schema.triggers
247+
WHERE triggers.trigger_name::text IN ('audit_trigger_row'::text, 'audit_trigger_stm'::text)
248+
ORDER BY schema, auditedtable;
249+
250+
COMMENT ON VIEW audit.tableslist IS $body$
251+
View showing all tables with auditing set up. Ordered by schema, then table.
252+
$body$;

0 commit comments

Comments
 (0)