[Gdal-dev] PostGIS primary key in CreateLayer

Frank Warmerdam warmerdam at pobox.com
Sun Dec 18 11:57:41 EST 2005


On 12/15/05, Craig Miller <craig.miller at spatialminds.com> wrote:
> I'm not sure if the primary key definition was ever added in CVS for the
> PostGIS drivers CreateLayer method.  If not, here is the snippet to add it.
>
>     if( !bHavePostGIS )
>         {
>         sprintf( szCommand,
>                  "CREATE TABLE \"%s\" ( "
>                  "   OGC_FID SERIAL, "
>                  "   WKB_GEOMETRY %s, "
>                  "   CONSTRAINT \"%s_pk\" PRIMARY KEY (OGC_FID) )",
>                  pszLayerName, pszGeomType, pszLayerName );
>         }
>     else
>         {
>         sprintf( szCommand,
>                  "CREATE TABLE \"%s\" ( OGC_FID SERIAL, CONSTRAINT \"%s_pk\"
> PRIMARY KEY (OGC_FID) )",
>                  pszLayerName, pszLayerName );
>         }

Craig,

I have applied your patch.

Thanks!
--
---------------------------------------+--------------------------------------
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