Moved Postgres functions and bodies out of static-pages-create.sql into separate files (just like for Oracle) - necessary to more cleanly support upgrade files. No other changes.
Added code to make use of David Walker's wonderfully abusive hack on the pg_proc table that showed me how to write recursive SQL functions. We now have good use of the index on tree_sortkey when climbing the tree, woo-hoo!