Postgresql – Restore postgres Dump gives Errors: types do not exist

postgresqlrestore

I´ve dumped a Database from an old Ubuntu machine with postgresql 8.4 wiandth postgis 1.5.
On a new ubuntu 12.04 I´ve installed Postgresql 9.1 also with postgis 1.5. (created the postgis_template with postgis.sql and spatial_ref_sys.sql).

When I restore the dump on the new machine, the data is build but I get 25 Error Messages like these

...    

pg_restore: [archiver (db)] Error from TOC entry 711; 1255 18533 FUNCTION gidx_in(cstring) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function public.gidx_in(cstring) does not exist
    Command was: DROP FUNCTION public.gidx_in(cstring);

pg_restore: [archiver (db)] Error from TOC entry 34; 1255 17743 FUNCTION geometry_send(geometry) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  type "geometry" does not exist
    Command was: DROP FUNCTION public.geometry_send(geometry);

pg_restore: [archiver (db)] Error from TOC entry 33; 1255 17742 FUNCTION geometry_recv(internal) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function public.geometry_recv(internal) does not exist
    Command was: DROP FUNCTION public.geometry_recv(internal);

pg_restore: [archiver (db)] Error from TOC entry 31; 1255 17740 FUNCTION geometry_out(geometry) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  type "geometry" does not exist
    Command was: DROP FUNCTION public.geometry_out(geometry);

pg_restore: [archiver (db)] Error from TOC entry 30; 1255 17739 FUNCTION geometry_in(cstring) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  function public.geometry_in(cstring) does not exist
    Command was: DROP FUNCTION public.geometry_in(cstring);

pg_restore: [archiver (db)] Error from TOC entry 709; 1255 18529 FUNCTION geography_out(geography) postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  type "geography" does not exist
    Command was: DROP FUNCTION public.geography_out(geography);

Can Anyone explain whats going on? And can I ignore those Errors?

Thanks!
With kind regards,

Toni

Best Answer

You have multiple errors. You need to read them carefully, and then read your dump file (find the lines referenced in the errors above and determine if where these errors are occurring is a serious problem, or something you can ignore) -- WE cannot tell you that because we really don't know what's important in your environment.

From what I see in your error messages it looks like your dump file tries to clean the old database contents (DROP functions, types, and tables) before it actually loads data, so if you're restoring to a system without the existing data you'll get errors when it tries to drop objects that don't exist.
If that's what's going on you probably don't have to worry about the errors (though you may want to make a dump without the "cleaning" commands for future use so you don't get them -- refer to the pg_dump man page for information on how to do that).

Now if you start getting errors CREATING functions/procedures those are more likely to be serious and require investigation and correction.