CALIFORNIA'S lame-duck governor, Arnold Schwarzenegger, has just scored a big victory. On June 16th he struck a tentative agreement with four public-sector unions, representing 23,000 of the state's 170,000 unionised state workers, over future pension benefits. If confirmed, the deal would require newly hired public employees such as firefighters and traffic police to contribute more of their own salaries, and retire later, to collect their pensions. The savings would be small. But there is a chance that California's other unions will follow with similar deals. If they do, the effect would be historic.

This is because it would begin the undoing of a policy disaster dating back to 1999. That was when the Democratic legislature and the then governor, Gray Davis, a Democrat elected with union support, thanked the unions by giving state workers pension increases of between 20% and 50%. Many highway-patrol officers, for example, were allowed to retire at 50 with 90% of their final salary. All told, California now has probably the most generous public-sector benefits in the country.

That, however, is not what outrages Mr Schwarzenegger, a Republican, or his brainy economic adviser David Crane, a Democrat. Rather, it is that the pension plans—above all the California Public Employees' Retirement System (CalPERS), the largest such scheme in America—pretended that this generosity would not cost anything. In 1999 the dotcom bubble was still inflating, and the plans' actuaries predicted that their retirement funds would gain enough value to pay the increased pensions. By implication, they assumed that the Dow Jones Industrial Average would reach 25,000 in 2009 and 28m in 2099. It is currently at around 10,300.

A few years ago Mr Crane tried, as a board member of the teachers' pension plan (CalSTERS), to make the assumptions more sane. His fellow Democrats voted him off the board. But since then the stockmarket has fallen sharply and California has tipped into budget crisis, exacerbated by the additional contributions that taxpayers are obliged to make to top up the public-sector pension funds.

On the same day that Mr Schwarzenegger struck his deal with the unions, for instance, CalPERS ordered the state to increase its annual pension payment to almost $4 billion. Two studies estimate California's unfunded pension liability at about half a trillion dollars, almost seven times its official debt.

Even some Democrats are starting to complain. Bill Lockyer, the state treasurer, is one. He warned the legislature that public-sector pensions will bankrupt the state and pointedly wondered whether the Democrats before him could fix the problem “because of who elected you”.

Voters are getting angry. Many find it ironic that those Democrats who are wailing loudest over cuts to schools, universities and health care include people who voted for the pensions that are now crowding out those very programmes. Most private-sector employees have defined-contribution plans, which determine how much employers and employees pay in but not how much pensioners will get out, and which have shrivelled with the stockmarket since 2008. They do not understand why they should now pay to maintain the more generous defined-benefit pensions of public-sector employees. To Adam Summers of the Reason Foundation, a think-tank in Los Angeles, the solution is clear. Public-sector pensions for new employees must become defined-contribution plans, as in the private sector.

That may be asking more than is politically feasible. Mr Schwarzenegger is hoping merely to roll back public pensions to the formulas in use before 1999. Many union members are promising a fight. Worse, it is an election year. Neither the Democrat nor the Republican running to succeed the governor has dared offer specifics about California's budget or pensions mess. And the unions are preparing to spend oodles of money on the race.