The current handling of feature ID generation when inserting new features into the data base is suboptimal. We need to define a strategy that is consistent across data stores yet allows for data store specific features.
One possible solution could be to have an fidGenerationType parameter to data stores. This can have the following minimum values:
auto (Means that the underlying data store will generate the FID automatically and data store implementations should do the equivalent of inserting null into the fid).
manual (Means that the data store implementation must handle generation of new valid fids. This could be done by incrementing the max current fid)
Specific data stores could then add options that support their own features. For example Oracle could add an option that defines a sequence like this:
The value for the fid will then be generated by calling seq_name.nextval.
For the JDBC data store we also need to define requirements for a valid FID column. I would suggest:
No compound primary keys.
* Only numeric primary keys if 'manual' fidGenerationType is specified.
* If no primary key is defined use a default that is either relevent to the DB or defined by the user.
I think we should decide on this strategy and document it before implementing. This issue can be the place for everyone to put their ideas forward. I would especially appreciate input from the users of Geoserver who seem to be the main user community, for the JDBC data stores at least.
CodeHaus Comment From: cholmes - Time: Thu, 18 Dec 2003 17:12:28 -0600
I've been meaning to start a discussion on this for awhile now, thanks for motivating Sean. I was thinking about the same thing - the fidGenerationType, able to set manual or automatic. I completely agree with the fid requirements, and yes, we should then clearly document what we support and do not support.
As for GeoServer, we could send an email to the list to see if anyone has input. I imagine that many of the postgis users probably use shp2pgsql to set up their dbs at first, and I'm pretty sure that the latest release of shp2pgsql declares a serial primary key, that automatically generates the fid.
CodeHaus Comment From: jgarnett - Time: Mon, 4 Oct 2004 16:21:05 -0500
Fid-exp fixed this for databases