CREATE OR REPLACE FUNCTION food600.bourak_zmena()
    RETURNS trigger
    LANGUAGE 'plpgsql'
    COST 100
    VOLATILE NOT LEAKPROOF
AS $BODY$
BEGIN
      
  IF (TG_OP = 'UPDATE') THEN
    IF 
     (NEW.c_karty   != OLD.c_karty)   OR
     (NEW.c_karty2  != OLD.c_karty2)  OR
     (NEW.koef_mnoz != OLD.koef_mnoz) OR
     (NEW.koef_ceny != OLD.koef_ceny)  
    THEN
      NEW.zmena := current_timestamp;
      PERFORM food600.f_zmeny_tab('bourak',NEW.zmena,NEW.c_data);
    END IF;   

  ELSIF (TG_OP = 'INSERT') THEN
   NEW.zmena := current_timestamp;
   PERFORM food600.f_zmeny_tab('bourak',NEW.zmena,NEW.c_data);
  END IF;
        
  RETURN NEW;
END;
$BODY$;
