Hay un error: ERROR: column "detenida" does not exist LINE 25: WHERE n.idnota =detenida ^