I'm posting here instead of pg mailing lists because this problem seems OpenACS related.
I'm saving file-storage files in the database and I use this command in my daily backup:
pg_dump -b -F c -o mydb_prod >mydb_prod.dmp.gz
To restore a development instance of the DB I first did this sequence;
createdb mydb_dev
pg_restore -d mydb_dev -F c -o mydb_prod.dmp.gz
but I got this error:
pg_restore: [archiver (db)] could not execute query: ERROR: function plpgsql_call_handler a\
lready exists with same argument types
I searched around and followed Tom Lane's suggestion, dropping mydb_dev and recreating a really empty database with:
create database mydb_dev with template = template0;
but then the same pg_restore gives this known error:
pg_restore: [archiver (db)] could not execute query: ERROR: Function 'tree_ancestor_keys(va\
rbit, int4)' does not exist
I tried to load the postgres.sql from the acs-kernel:
psql -f packages/acs-kernel/sql/po\
stgresql/postgresql.sql mydb_dev
as I usually do before restoring plain text databases, but then I get again the first error
pg_restore: [archiver (db)] could not execute query: ERROR: function plpgsql_call_handler a\
lready exists with same argument types
It seems that pg_restore, contrary to psql, stops when trying to create a function and this already exists.
Now I am in loop and don't know how to proceed.
Hope that someone has already encountered and solved this problem.