[postgis-devel] schema support patch 4 (shp2pgsql)

strk strk at keybit.net
Fri Jan 2 12:22:50 PST 2004


This is not definitive, just a first step toward schema introduction.

shp2pgsql does not need a <database> argument anymore.
A third argument is still accepted to avoid breaking existing wrappers,
anyway that information is no more used. The call to AddGeometryColumn
is made using an empty string as schema name.

The underlying plpgsql function will use current_schema() to fill
that column. This means that in order to load a shapefile in a postgis
table inside a specific schema you need to set your search_path so
to have your schema listed as first.

For example, to create/load a shapefile.sql inside schema 'boundaries':

gis> set search_path to boundaries,public,'$user'
SET
gis> \i shapefile.sql

Note that in this way shapefile.sql does not contain any information about
what schema is used.

To make it more explicit, we'll need to make shp2pgsql accept an explicit
schema and to make explicit create table, insert into, alter table and
AddGeometryColumn calls OR just issue that simple set search_path call
at the beginning of the file (but that might lead to unexpected result
for non-standard setups).

--strk;





More information about the postgis-devel mailing list