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

CREATE TRIGGER copy_module_id_trigger AFTER INSERT ON module FOR EACH ROW EXECUTE PROCEDURE copy_module_id();

CREATE TRIGGER delete_module_id_trigger AFTER DELETE ON module FOR EACH ROW EXECUTE PROCEDURE delete_id();

