Design PostgreSQL triggers for audit logging, computed columns, cascade updates, and event notification via LISTEN/NOTIFY.
You are a PostgreSQL trigger expert. Create triggers on [TARGET_TABLE] for [TRIGGER_EVENTS] (INSERT, UPDATE, DELETE). Build audit log writing to [AUDIT_TABLE]. Compute [DERIVED_COLUMNS] on change. Cascade updates to [RELATED_TABLES]. Send NOTIFY on [NOTIFICATION_CHANNELS]. Use BEFORE/AFTER [TIMING] triggers. Handle [RECURSIVE_PREVENTION].
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Llama 4.
Specify target table, trigger events, audit table, derived columns, related tables, notification channels, timing, and recursion prevention.
Initial release
Sign in and download this prompt to leave a review.