Skip to content

Commit

Permalink
Merge pull request 2ndQuadrant#20 from mikijov/master
Browse files Browse the repository at this point in the history
Fix to allow auditing tables in other schemas
  • Loading branch information
ringerc authored Jan 3, 2019
2 parents 05137fa + feae2cd commit f67fbeb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions audit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ DECLARE
_q_txt text;
_ignored_cols_snip text = '';
BEGIN
EXECUTE 'DROP TRIGGER IF EXISTS audit_trigger_row ON ' || quote_ident(target_table::TEXT);
EXECUTE 'DROP TRIGGER IF EXISTS audit_trigger_stm ON ' || quote_ident(target_table::TEXT);
EXECUTE 'DROP TRIGGER IF EXISTS audit_trigger_row ON ' || target_table;
EXECUTE 'DROP TRIGGER IF EXISTS audit_trigger_stm ON ' || target_table;

IF audit_rows THEN
IF array_length(ignored_cols,1) > 0 THEN
_ignored_cols_snip = ', ' || quote_literal(ignored_cols);
END IF;
_q_txt = 'CREATE TRIGGER audit_trigger_row AFTER INSERT OR UPDATE OR DELETE ON ' ||
quote_ident(target_table::TEXT) ||
target_table ||
' FOR EACH ROW EXECUTE PROCEDURE audit.if_modified_func(' ||
quote_literal(audit_query_text) || _ignored_cols_snip || ');';
RAISE NOTICE '%',_q_txt;
Expand Down

0 comments on commit f67fbeb

Please sign in to comment.