Forum OpenACS Q&A: Re: pg_dump and pg_restoring from production to dev

Collapse
Posted by Don Baccus on
Connect essentially logs in as the given user.  This ensures that if you're restoring a database that all items are recreated owned by the right user - important for [PG not OpenACS] permission checking.

The big gotcha is that pg_dump doesn't guarantee all function definitions are dumped earlier than they're used - a minor and annoying but not dangerous bug.  In OpenACS-land this is usually manifested by references to postgresql.sql-defined functions being in the dump before they're defined.

So I always do:

psql my_db -f acs-kernel/sql/postgresql/postgresql.sql

before attempting a restore then ignore the dup function definitions that result.