@matigo It boggles my mind. Many hundreds of businesses run that report at the end of the month (some weekly). In 13 years, that bug has never once surfaced.
Upon further review of the code, that SQL was only generated if a customer was using a very advanced feature that almost no-one else uses. Namely because they don't know about it nor do they need it anyway. Very specific use case.
if(!lastFilterName.isEmpty())
ss << " AND w.won IN (SELECT won FROM "
<< lastFilterName << ')';
Incredible how a line of code, in service for almost 13 years without incident, can only be called in a one in a million circumstance and bomb.
It's part of some generated SQL and that particular case is never reached. It's a one in a million shot the temporary table referenced by lastFilterName exists at that stage. (It's complicated)
In this case it was and the w.won column blew massive chunks because NOTHING in that generated SQL ever selected anything and referenced it as as w. (Should have been s.). Probably a copy/paste thing we did years ago and we just didn't catch it…because that line was never, ever reached. In hundreds of installations. For 13 years. Until two hours ago in Alabama.
This is why I live in outer space and Skyrim after hours.
Since I have been inundated by work-related things, I have decided to do some non-work-related things.
Wrote a mod to un-do a "fix" the Skyrim unofficial patch made to Redbelly Mine and Shor's Stone. I rather miss having a early source of ebony ore.
Wrote a mod to make the Greybeard robes craftable and wearable. Plus, made a light armor variant that can be crafted and upgraded.
Modified a couple of my favorite, small house mods to my liking and repackaged them.
So, I've decided to live in Skyrim instead of reality this evening.
@matigo It wasn't. Failure was happening deep within a stored procedure. One in a million set of circumstances that allowed it to get as far as it did before failing.
Chances of it happening again are infinitesimal but there is debugging output now -
just in case.
Nothing like remotely chasing database corruption issues while eighty people are waiting on paychecks.
EDIT: Places debugging info in stored procedure so he gets more than Exception: CALL pr_calc() the next time. Derp