CREATE OR REPLACE FUNCTION copy_company_id() RETURNS trigger AS '
 BEGIN
  INSERT INTO object (objectid, objecttypeid) VALUES (new.id, ''company'');
  RETURN NULL;
 END
' LANGUAGE plpgsql;

CREATE TRIGGER copy_company_id_trigger AFTER INSERT ON company FOR EACH ROW EXECUTE PROCEDURE copy_company_id();

CREATE TRIGGER delete_company_id_trigger AFTER DELETE ON company FOR EACH ROW EXECUTE PROCEDURE delete_id();

