CREATE OR REPLACE FUNCTION nf_4e662f03_1_aaaaa() RETURNS trigger AS $BODY$ BEGIN IF (NEW.data->>'temperature')::int > 70 THEN INSERT INTO notifications_queue VALUES('aaaaa', '4e662f03', 1); END IF; RETURN NEW; END; $BODY$ LANGUAGE plpgsql VOLATILE COST 100; CREATE TRIGGER tr_4e662f03_1_aaaaa AFTER INSERT on dev_4e662f03_1 FOR EACH ROW EXECUTE PROCEDURE nf_4e662f03_1_aaaaa();