DO
$$
BEGIN
IF NOT EXISTS (SELECT trigger_name FROM information_schema.triggers WHERE trigger_schema='food600' and trigger_name='obraty_prepocet_po') THEN
	CREATE TRIGGER obraty_prepocet_po
	    AFTER INSERT OR DELETE OR UPDATE 
	    ON food600.obraty
	    FOR EACH ROW
	    EXECUTE PROCEDURE food600.prepocet();
END IF;
END
$$
