[postgis-users] Postgis Restore no with correct search_path

Stefan Schwarzer stefan.schwarzer at grid.unep.ch
Wed Feb 7 01:29:08 PST 2007


> But although it imports the sql fil, it does not import the Postgis  
> part.
>
> The reasons seems to be this here:
>
>
> CREATE TABLE admin01 (
>     gid serial NOT NULL,
>     cntry_name character varying(42),
>     cntry_code character varying(13),
>     name character varying(37),
>     adm1_code character varying(12),
>     country_id bigint,
>     the_geom postgis.geometry,
>     CONSTRAINT enforce_dims_the_geom CHECK ((postgis.ndims 
> (the_geom) = 2)),
>     CONSTRAINT enforce_geotype_the_geom CHECK  
> (((postgis.geometrytype(the_geom) = 'MULTIPOLYGON'::text) OR  
> (the_geom IS NULL))),
>     CONSTRAINT enforce_srid_the_geom CHECK ((postgis.srid(the_geom)  
> = 4326))
> );
> ERROR:  type "postgis.geometry" does not exist


When re-importing the postgis-dump into the new database, I see that  
the postgis functions have been installed in schema public, instead  
of schema gis, where they have been originally. The code in the dump  
file reads like this:

BEGIN
	EXECUTE 'SET local search_path = '||$2||',public';
	RETURN public.build_histogram2d($1,$3,$4);
END

Don't know what the $2 is standing for. But my old database shows the  
schema-search-path=
	
	metadata,admin,gis,public,postgis

whereas the new one only shows

	public

So, no wonder that there are some problems.... How can I modify the  
search-path command in the SQL file (or wherever) so that it doesn't  
install things automatically in schema public, but postgis or gis?




More information about the postgis-users mailing list