[postgis-users] shp2pgsql sequence and pkey

strk strk at freek.keybit.net
Wed Aug 13 03:12:17 PDT 2003


shp2pgsql assumes schemas are available when calling
pg_catalog.setval on gid sequences.

As a quick fix I copied main Makefile USE_VERSION detection
and CFLAG provision of it, then I added a conditional in shp2pgsql.c.

Said that, I would not post the patch since I'm sure this is 
really not the clean way to do it.

My question is: why should shp2pgsql add explicit values to a serial
field ? Since gid is declared as a serial number it would automatically
get the next value from the generated sequence and thus there would
be no need to set its value explicitly (as an effect the import
will be slower and the dump files smaller and cleaner).

Finally my opinion about sequences and primary key: they should be
optional. I'm ok with previous layout, I don't like to have the db
full of sequences and indexes. I think the import step should be
essential, indexes and constraints should be added by the DBA based
on application specifications (why not a GiST index then ?).

--strk;



More information about the postgis-users mailing list