Links

   Quran Explorer - Interactive Audio Recitations & Translations

Friday, April 19, 2013

Conditional Triggers in Postgres


Since version 9.0 we can execute triggers conditionaly

Example

CREATE TRIGGER trGenerateSchedule
AFTER INSERT OR UPDATE OF is_confirmed ON job_location
    FOR EACH ROW
    WHEN (NEW.is_confirmed = true)
    EXECUTE PROCEDURE generateSchedule();

This is a column trigger that listens for a change (to true) of a single column in the job_location table

No comments:

Post a Comment

Feel free to leave a comment