0

I am trying to import a sql dump to postgresql db as -

sudo su postgres -c psql dbname < mydb_dump.sql 

This gives errors as -


SET
SET
SET
SET
SET
SET
ERROR:  function "array_accum" already exists with same argument types
ALTER AGGREGATE
ERROR:  function "c" already exists with same argument types
ALTER AGGREGATE
ERROR:  duplicate key value violates unique constraint "pg_ts_config_cfgname_index"
ERROR:  duplicate key value violates unique constraint "pg_ts_config_map_index"

and so on this. What might be wrong with that? Tried googling for it, but couldn't find any pointers over it.

Postgresql version is 8.4.1

Thanks !!

rtdp
  • 2,067
  • 1
  • 17
  • 32

1 Answers1

1

you should to remove shared functions and objects from database, before you do dump or before you load dump. You have these functions and objects registered in template1, and when you create new database, then these objects are there - and you can see errors when dump try to create it again.

This issue is well solved in PostgreSQL 9.1. For older versions try to use option --clean for pg_dump

Pavel

Pavel Stehule
  • 42,331
  • 5
  • 91
  • 94