Forum OpenACS Q&A: Re: error restoring a database backup to a different database

The advice is right but it's worth explaining the reason ...

pg_dump does an imperfect job of dumping stuff out in correct order.  Function definitions can be dumped after their first use and this is true, in particular, of our tree functions.  This is why loading the postgres.sql file first works (just ignore any dupe-definition errors you get afterwards).