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

CREATE TRIGGER copy_region_id_trigger AFTER INSERT ON region FOR EACH ROW EXECUTE PROCEDURE copy_region_id();

CREATE TRIGGER delete_region_id_trigger AFTER DELETE ON region FOR EACH ROW EXECUTE PROCEDURE delete_id();

