I've made my first round of fixes which causes the group hierarchies to be built correctly. The Oracle version worked for subsites mounted below the main site (because the "find the parent" query, though incorrect, was at least incorrect in a way that always returned the main site node). The PG version was mostly just backwards.
There was also a cart-before-the-horse problem in the subsite mounting code that caused the corrected queries for both RDBMSs to fail. This had been masked in the Oracle version by the bug that caused it to always return the main site node.
Now that the application groups and the composition relationships are being built correctly I see that the site map page in PG is incorrect, and adding users doesn't seem to work. I haven't checked the Oracle version yet.
I've been very busy this week with client work so haven't had time to get back to it. My plan is to spend part of tomorrow (Sunday) plugging away at Phase II Phixing...
I've been holding off on committing until I have something that works more or less coherently.