WHEN Ricardo Aldana, a politician representing Mexico’s embattled oil-workers’ union, harangued the lower house of Congress in the early hours of Saturday August 2nd, it wasn’t the heckling cries of “drunkard” from his opponents that should have bothered him. It was the cold shoulder he received from his own Institutional Revolutionary Party (PRI).

The union, of which he is treasurer, is under one of the worst assaults since its former leader Joaquín Hernández Galicia, was seized by bazooka-wielding soldiers in 1989 and jailed. Now that the PRI, at President Enrique Peña Nieto’s bidding, has virtually rewritten the rules governing Pemex, Mexico’s state oil company, Mr Aldana and his boss, Carlos Romero Deschamps (pictured), must be worried about what’s in store for them.

The union’s extraordinary relationship with Pemex has been splashed all over the front pages of Mexican newspapers recently—a convenient diversion for the government as it sidles the energy bills through Congress. First, congressmen have drawn attention to the whopping size of the oil workers’ unfunded pension liabilities, which have been negotiated with Pemex over decades. According to Luis Videgaray, the finance minister, they amount to 1.7 trillion pesos ($129 billion) on an actuarial basis, or about 10% of GDP (though Congress puts them lower). That’s not far short of the size of the entire private pension industry (13% of GDP), which, unlike that of Pemex, is painstakingly financed out of every paycheck by ordinary workers.

As part of the reform, some of these pension liabilities will be shifted onto the government’s books, which critics have interpreted as a bailout of the union by its friends in government. Far from it. The amount will depend on by how much Pemex and the union agree to reduce the debts—for instance, by raising Pemex workers’ retirement age from 55 to 65 and cutting other benefits. Expect the union to be clobbered.

Second, a scandal has emerged over a 30-year-old business in which the union would take from Pemex the “slops” of oil too dirty to refine and sell them on its own account. Originally there was a contract to sell the slops to a Texan firm, Arriba, but it broke down. Decades of lawsuits later, a Texan judge last month upheld a decision to fine the union for breaching the contract. Press reports say the union could have to fork out as much as $1.4 billion because of accumulated interest. In the past, Pemex would have surreptitiously helped to cover such costs, but now it will be prohibited from doing so. That could further weaken the union’s top brass.

The Pemex union used to be a revered institution. One of its strikes helped spur the 1938 nationalisation of the oil industry. But over time its leadership, granted special favours for supporting the PRI, started to operate in a universe of its own. Even now, Mr Romero Deschamps’ offspring live plutocratic lifestyles. According to indiscreet Facebook postings, his daughter likes to jet around the world and put her pet bulldogs in luxury hotels.

The unwritten rule is that to continue to live in such style, the big union bosses must be stalwarts of the PRI. The leaders of the oil-workers’ union have proven to be that by backing the energy reforms, albeit through gritted teeth. But when the PRI refused to support Mr Aldana’s initiative to water down the pensions deal, it started to look like the rules of the game may change. Whether or not the government actually begins to tackle the flagrant excesses of the union—rather than turning a blind eye to them—will be a sign of its seriousness in modernising Pemex.