[postgis-users] shp2pgsql sequence and pkey

Jeff Lounsbury jeffloun at refractions.net
Wed Aug 13 09:38:25 PDT 2003


It adds explicit values to the serial column because when you are appending
to an existing table and you use the Dump format, the serial doesn't
auto-increment like it would in insert mode...
-Jeff

strk wrote:

> 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;
>
> _______________________________________________
> 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