Are you talking about those evil util_memoize calls that don't utilize a proc wrapper but rather pass in the database query directly, where it then gets executed in util_memoize's context?
Those should be fixed by wrapping the query in a proc rather than passing "[list db_string etc etc]" into util_memoize. The query dispatcher should then be able to properly associate the query with the wrapper proc.
This is a PITA but at least they can be found by grep'ing for "util_memoize".
We recognize that this first porting effort's going to take a fair amount of work, some of it tedious. We can't automate the entire process of separating queries from Tcl but we can automate some of it.
The good news is that once we're one with this first effort porting to other databases will be much simpler.
And, of course, unlike anything seen from aD we will be supporting two databases right off the bat. Simply porting this to PG and abandoning Oracle would certainly simplify our job but we want to support multiple databases.