hotosm / osm-tasking-manager2

Designed and built for Humanitarian OpenStreetMap Team collaborative emergency/disaster mapping, the OSM Tasking Manager 2.0 divides an area into individual squares that can be rapidly mapped by thousands of volunteers.
http://tasks.hotosm.org
Other
425 stars 156 forks source link

Fix SQL Import #970

Open davidvasandani opened 7 years ago

davidvasandani commented 7 years ago

@pgiraud thanks for your help. The current error;

could not access file "$libdir/postgis-1.5": No such file or directory

Postgis 1.5 isn't available in apt and when building from source there is an incompatibility with Postgres 9.

pgiraud commented 7 years ago

No it's not dependent on Postgis 1.5. I have a version running 2.3 on my computer right now. When do you get this error?

bgirardot commented 7 years ago

I think they are output from pg_restore trying to restore to a new installation of tm2 so we can migrate to new dedicated hardware

davidvasandani commented 7 years ago

@pgiraud, @bgirardot is correct. This is the error during a pg_restore. The full output is here.

pgiraud commented 7 years ago

Hi. I can confirm that the problem we have here is that we are trying to restore a dump created with a 1.5 version of PostGIS into a 2.x. The pg_restore command is not able to handle this.

However, there's a postgis_restore.pl perl script which can help.

The following command will restore the database after migrating it from 1.5 to 2.1. It leads to almost no error provided you create the database with taskmanv2 as owner. I don't think it's possible to change the owner or roles using this command unfortunately. Anyway, it's not a bad to use a username other than "www-data".

perl /usr/share/postgresql/9.3/contrib/postgis-2.1/postgis_restore.pl osmtm2_038.dmp | sudo -u postgres psql -d osmtm