Skip to content

Commit 0739dec

Browse files
committed
Added a statement to create a view showing all tables (and schemas) for which auditing has been set up
1 parent 05137fa commit 0739dec

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 = 'audit_trigger_row'::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)