Hi all,
===================================
CREATE FUNCTION trigger_test_func()
RETURNS trigger
AS '
DECLARE
cnt int4;
BEGIN
SELECT INTO cnt COUNT(*)
FROM table_test
WHERE ip = new.ip;
IF cnt > 50 THEN
-- THERE THE "INSERT" HAS TO BE STOPED
END IF;
RETURN new;
END;'
LANGUAGE 'plpgsql';
CREATE TRIGGER trigger_test
BEFORE INSERT
ON table_test
FOR EACH ROW
EXECUTE PROCEDURE trigger_test_func();
===================================
How could i stop Inserting record into table by some condition?
Thanx!