[Gdal-dev] PostGIS primary key in CreateLayer
Craig Miller
craig.miller at spatialminds.com
Thu Dec 15 18:16:48 EST 2005
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
More information about the Gdal-dev
mailing list