문제

I have database1 where postgis is installed in the public schema. And database2 where postgis is located in a schema called postgis.

When I dump database1.schema1, schema1.table1 references its geom column as public.geometry.

Therefore pg_restore throws "schema public does not exists" error because schema1.table1 has public.geometry column and the schema does not exists nor is postgis installed in that schema.

How can I make a clean pg_dump without having schema qualified geometry columns?

The database2 search_path points to the schema postgis. I am using PostgresSQL 10.

도움이 되었습니까?

해결책

You cannot do that. Install PostGIS in the same schema in both databases. That shouldn't be a problem in the new database.

The alternative would be to manually edit the dump file, which is tedious and error prone.

다른 팁

As stated By Laurenz, you must install PostGIS in the same schema in both databases.

Afterward, it is possible to migrate postgis extensions doing the following : https://www.postgis.net/2017/11/07/tip-move-postgis-schema/

The migration can be done in an intermediate DB if need be.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 dba.stackexchange
scroll top