You might be better to use the OID value for the feature identifier. After all, 
it is entirely possible to have a table with only a geometry column. The OID 
value is what the mapserver connector uses by default (but you can specify 
another column if you want). The OID is an "invisible" column that postgres 
adds to all tables, if you didn't know - it's the "object identifier" and is at 
least unique for all of the rows in a given table.

I would highly recommend making this a configurable option, as your identifying 
column should probably have an index, as it is silly to have to index another 
column when you already have a perfectly good, indexed, unique value.

Chris Hodgson

Quoting cholmes@limegroup.com:

> Apologies if this gets posted twice, I'm having trouble posting to lists
> for some reason:
> 
> Hey, I work on the PostgisDataSource module for geotools2.  Sorry for
> taking so long to get back on this issue.  No, a gid field is not a
> requirement of all spatial tables.  We made that a temporary assumption
> to get things working, using the gid field as the feature ID.  I've
> fixed the code, now the datasource uses the first column as the Feature
> ID, which I think is a valid assumption, as the SFS for SQL spec, in
> section 3.2.4.2 has the general format for the creation of a feature
> table, and the first column is <FID name> <FID type>.  So now as long as
> the first column of your table holds the feature ID things will work.
> Let me know if that is not a valid assumption, and I'll figure out
> another way to do things.  James has made a new release of the wms, that
> incorporates my fixes as well as some new caching code that speeds
> things up.  It's available at:
> http://sourceforge.net/project/showfiles.php?group_id=4091&release_id=127682,
> 
> the file is gt2wms-alpha-2.zip.  And thank you so much for testing and
> input.  Let us know about any other bugs that hold you up.
> 
>                     Chris
> 
> On Friday 06 December 2002 12:47 am, Rueben Schulz wrote:
> > Hello,
> >
> > This is an update of my progress with gt2wms testing with postgis data.
> > I now have lots of logging output, and the source code to help me track
> > down problems.
> >
> > None of my data was displaying initially, because of a database
> > permission problem. I have learned that the postGIS connection uses the
> > geometry_columns table to find the geometry column to use for a spatial
> > table. I did not have read permission on this. With this fixed I now
> > have 2 of my 8 datasets displaying.
> >
> > The rest of my data is not displaying because of a
> > ArrayIndexOutOfBoundsException from the postGIS connection. It appears
> > that the PostgisDataSource connection assumes that the spatial table has
> > a gid field.
> >
> > My question to the postGIS community then is: is a gid field a
> > requirement of all spatial tables? I have not come across this in any
> > documentation.
> >
> > I also have another problem with a multipolygon dataset, but it will
> > have to wait until the above is sorted out.
> >
> > Rueben
> >
> >
> 
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 





