Skip to content

audit_skip_noop

File: schema/functions/audit_skip_noop.yaml · returns trigger · plpgsql · SECURITY INVOKER · VOLATILE

The BEFORE UPDATE trigger function for the audit mixin (00_audit_skip_noop, runs first). Cancels no-op UPDATEs so they don’t generate an MVCC tuple, bump updated_at, or produce spurious audit_log rows.

No parameters.

BEGIN
IF TG_OP = 'UPDATE' AND NEW IS NOT DISTINCT FROM OLD THEN
RETURN NULL;
END IF;
RETURN NEW;
END;

Returning NULL from a BEFORE ROW trigger skips the operation for that row entirely. Because it carries the 00_ prefix it fires before audit_stamp (10_), so an unchanged row never even reaches the stamping logic.