We study how aggregate demographic and economic risks affect the finances of the Finnish earnings-related pension system and the different generations of the insured. As a partially funded defined-benefit system, demographic risks and asset yield risks directly affect the contributions. Our analysis, based on a general equilibrium overlapping-generations model, show that these risks also affect wages and thus pension benefits and replacement rates. Productivity growth also affects wages and thus both contributions and benefits. We also analyze quantitatively the use of pension funds with the aim of smoothing contributions over time and compare the outcomes of the current system to an alternative system with the same benefit rules but no funding. Smoothing is affected by the revisions in long-term forecasts and is thus imperfect. In addition, variation in asset yields often cause clashes with solvency limits. We find that funding results in more varying contributions over time than would be the case without funding. Concerning generational equity, young generations benefit from funding in the form of lower contributions and higher wages, and their consumption possibilities are further increased by the improved fiscal stance of the state and municipalities.