Ok, so I was wrong about there being zero chance of this thread generating useful information.
Thanks for that link. The PDF is heavily focused on MS SQL Server and Oracle, and a bit light on solutions, but it contains good examples of techniques. The section on testing is particularly helpful.
All of my database work has been in protected situations where no outside connection to the database server existed. It didn't matter if a query returned more information than necessary because the only people able to submit a query were already trusted with all data.
I've never fallen into a "dead end" like is described in the part you quoted, but I did have a query (not in the journals test) that included over 300 "union all" clauses. That's over 300 subexpressions where such a dead end loop could have happened. It's as nerve wracking as finishing an engine rebuild and wondering where the air filter wingnut went.