Perhaps we should take this discussion on to the geotools list?
(We're talking about FID for features being inserted into PostGIS (or
other JDBC datastores) where the FID is being derived from a SERIAL
column. Serial columns are maintained by the database.)
Current most of the FID mappers all work by taking a feature and
determining the FID by looking at it. If you use the SERIAL column,
you have to actually insert the feature into the DB then read it back
to find out what the actual column's value is.
For PostGIS, you can cheat and directly manipulate the sequence that
postgresql builds to manage the serial column. For example, the
statement;
CREATE TABLE test (id SERIAL);
gets translated into:
CREATE SEQUENCE "test_id_seq" start 1 increment 1 maxvalue
9223372036854775807 minvalue 1 cache 1;
CREATE TABLE "test" ("id" integer DEFAULT nextval('"test_id_seq"'::text)
NOT NULL);
CREATE UNIQUE INDEX test_id_key ON test USING btree (id);
SELECT setval ('"test_id_seq"', 1, false);
So you can use the "test_id_seq" sequence to generate new FIDs.
I'm sure that there's something in JDBC that allows us to manage this
(or, at least their ought to be).
dave
----------------------------------------------------------
This mail sent through IMP: https://webmail.limegroup.com/