[Gdal-dev] CreateLayer: PostGIS primary key?

Frank Warmerdam warmerdam at pobox.com
Fri Dec 2 21:17:20 EST 2005


On 12/2/05, Craig Miller <craig.miller at spatialminds.com> wrote:
> Is there a way to specify that the FID column should be the primary key when
> creating a PostGIS layer with
> OGRDatasource::CreateLayer?
>
> Is there any reason why I wouldn't want to use the FID column as the primary
> key?

Craig,

In normal situations I can't see any reason the FID column should not
be the primary key.   There is currently no way to make CreateLayer()
make the OGC_FID column the primary key as part of it's operation.
I can't see any harm in adding that though.

What would I change the following to, in order to make OGC_FID
the primary key?

                 "CREATE TABLE \"%s\" ( "
                 "   OGC_FID SERIAL, "
                 "   WKB_GEOMETRY %s )",

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list