db-t.sql 391 Bytes
Newer Older
Vladislav Rykov's avatar
Vladislav Rykov committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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();