CREATE OR REPLACE FUNCTION update_object_vectors() RETURNS TRIGGER AS $$
 BEGIN
  PERFORM set_object_vectors(NEW.id);

  RETURN NULL;
 END
$$ LANGUAGE plpgsql;


DROP TRIGGER update_object_name_trigger ON street;
CREATE TRIGGER update_object_name_trigger AFTER INSERT OR UPDATE OF name_en, name ON street FOR EACH ROW EXECUTE PROCEDURE update_object_vectors();

DROP TRIGGER update_object_name_trigger ON region;
CREATE TRIGGER update_object_name_trigger AFTER INSERT OR UPDATE OF 
  name_en, name_de, name_fr, name_it, name_es, name_ru, name_pt, name_sv, name_pl, short_name,
  name_ka,name_sq,name_ur,name_sw,name_ta,name_sl,name_tl,name_fa,name_he,name_uk,name_el,name_sr,name_hr,name_vi,name_lt,name_lv,name_et,name_ca,name_ro,
  name_hu,name_bg,name_th,name_tr,name_id,name_hi,name_ko,name_ar,name_ct,name_zh,name_cs,name_da,name_ja,name_nl,name_fi
 ON region FOR EACH ROW EXECUTE PROCEDURE update_object_vectors();

DROP TRIGGER update_object_name_trigger ON company;
CREATE TRIGGER update_object_name_trigger AFTER INSERT OR UPDATE OF name, name_en, address, cityid ON company FOR EACH ROW EXECUTE PROCEDURE update_object_vectors();

DROP TRIGGER update_object_name_trigger ON module;
CREATE TRIGGER update_object_name_trigger AFTER INSERT OR UPDATE ON module FOR EACH ROW EXECUTE PROCEDURE update_object_vectors();

DROP TRIGGER update_object_name_trigger ON structure;
CREATE TRIGGER update_object_name_trigger AFTER INSERT OR UPDATE OF pinpoint, style, usage_main, address, facade_color, status, structural_form, name_en, name_ru, name ON structure FOR EACH ROW EXECUTE PROCEDURE update_object_vectors();


