DO
$$
BEGIN
IF NOT EXISTS (SELECT trigger_name FROM information_schema.triggers WHERE trigger_schema='food600' and trigger_name='karty_calcceny') THEN
	CREATE TRIGGER karty_calcceny
	    AFTER UPDATE 
	    ON food600.karty
	    FOR EACH ROW
	    EXECUTE PROCEDURE food600.calcceny();
	ALTER TABLE food600.karty DISABLE TRIGGER karty_calcceny;
END IF;
END
$$
