[postgis-users] shp2pgsql options?

Nicolas Ribot nicky666 at gmail.com
Mon Mar 20 12:58:53 PST 2006


Hi Thom,

You can tell postgres to create OID by default, by editing the
postgresql.conf file and setting (or adding if not present):
default_with_oids = on

But you can also modify your mapfile(s) to add a "USING UNIQUE <unique
key column>
" on your layer definition.

Nicolas

On 3/20/06, Thom DeCarlo <t.r.decarlo at larc.nasa.gov> wrote:
> Hello,
> I've been trying to load a set of shapefiles into a PostgreSQL 8.1.1 +
> PostGIS 1.1.0 database and having a bit of trouble with missing "oids". I've
> read that the current PostgreSQL doesn't create tables with OID by default,
> but they are required for use with MapServer. Due to that, my load process
> becomes:
>
> shp2pgsql -p -I -s <EPSG> shapefile.shp tablename >tablename_create.sql
> vi tablename_create.sql
>    add "WITH OIDS" to the "CREATE TABLE" command
> psql -d database -f tablename_create.sql
> shp2pgsql -a -s <EPSG> shapefile.shp tablename | psql -d database
>
> That's a bit of a pain when dealing with hundreds of shapefiles. Is there an
> option for shp2pgsql (maybe "-O") that would tell it to create the tables
> with OIDS?
>
> Thanks,
> Thom
>
> --
> Thom DeCarlo
> ----------------------------------------
>      there was coffee.
>      life would go on.
>           william gibson, the winter market
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list