Skip to content

Commit

Permalink
Do not execute insert audit on delete query
Browse files Browse the repository at this point in the history
  • Loading branch information
kouylekov-usit committed Jun 21, 2024
1 parent 0e51d87 commit a2bd027
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/audit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ create or replace function update_audit_log_objects()
if
old_data != new_data
or (old_data is null and new_data is not null)
or (new_data is null and old_data is not null)
or (new_data is null and old_data is not null and TG_OP != 'DELETE')
then
insert into audit_log_objects (identity, operation, table_name, row_id, column_name, old_data, new_data)
values (session_identity, TG_OP, table_name, NEW.row_id, colname, old_data, new_data);
Expand Down

0 comments on commit a2bd027

Please sign in to comment.