CREATE OR REPLACE FUNCTION updateBaspersonFromMioloUser (iduser INT)
/**
  NAME: updateBaspersonFromMioloUser
  DESCRIPTION: Edita campos do usuário na basperson com base em dados da miolo_user

  REVISIONS:
  Ver        Date        Author                Description
  ---------  ----------- --------------------  ------------------------------------
  1.0        21/10/2025  Daniel A. Corbellini  1. Função criada.
*/
RETURNS void AS $$
BEGIN
  UPDATE basperson AS bp 
    SET
      name = mu.name,
      miolousername = mu.login,
      login = mu.login,
      password = mu.m_password
    FROM miolo_user as mu
      WHERE bp.miolousername = mu.login;
END;
$$ LANGUAGE plpgsql;
