PostGISAutoIncrementFIDMapper doesn't support non-serial primary keys
---------------------------------------------------------------------
Key: GEOT-953
URL: http://jira.codehaus.org/browse/GEOT-953
Project: GeoTools
Issue Type: Bug
Components: data postgis
Affects Versions: 2.2.0
Reporter: Cory Horner
Fix For: 2.2.1, 2.3
A typical postgis table has the following definition:
CREATE TABLE codel_parcelle2
(
gid bigserial NOT NULL,
the_geom geometry,
CONSTRAINT pk_codel2_parcelle PRIMARY KEY (gid),
CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = -1)
)
WITHOUT OIDS;
although the fid is usually of type serial rather than bigserial... an
equivalent table is:
CREATE TABLE codel_parcelle
(
gid int8 NOT NULL DEFAULT nextval('codel_parcelle_gid_seq'::text),
the_geom geometry,
CONSTRAINT pk_codel_parcelle PRIMARY KEY (gid),
CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = -1)
)
WITHOUT OIDS;
In both cases the sequence is like:
CREATE SEQUENCE codel_parcelle_gid_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 4134
CACHE 1;
Currently PostGISAutoIncrementFIDMapper does not support the second case, even
though it is equivalent and logical. Fixing this issue may take the form of:
a) figuring out what the sequence is and calling currval('sequence_name',
'table_name') on it (after calling _get_serial_sequence fails)...
b) changing the way FID mapper works
c) doing it properly
In the meantime, users can change their table definitions to use
serial/bigserial if they wish to support PostGIS editing.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel