[Geoserver-users] fid generation

Hi Andrea,

you're right, it is a view with a primary key, and the primary key has a
value of 1 for all rows. I think I needed this when Geotools suddenly
required a primary key 1 year back. I need to revert these changes.

Sorry for the confusion.

CREATE VIEW V_KMMARKERINGEN_VWG_NAAM AS SELECT DISTINCT(VWG_NAAM), 1 AS
OGR_FID FROM V_KMMARKERINGEN ORDER BY VWG_NAAM

ALTER VIEW V_KMMARKERINGEN_VWG_NAAM ADD CONSTRAINT
PK_V_KMMARKERINGEN_VWG_NAAM PRIMARY KEY(OGR_FID) DISABLE NOVALIDATE;

Best regards,
Bart

--
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl

--------- Oorspronkelijk bericht --------
Van: Andrea Aime <aaime@anonymised.com>
Naar: Bart van den Eijnden OSGIS <bartvde@anonymised.com>
Cc: Justin Deoliveira <jdeolive@anonymised.com>,
geoserver-users@lists.sourceforge.net
Onderwerp: Re: [Geoserver-users] fid generation
Datum: 14/11/07 11:47

Bart van den Eijnden (OSGIS) ha scritto:
&gt; Hi Justin,
&gt;
&gt; I was using an Oracle table and not a PostgreSQL table (should have
&gt; mentioned that before :slight_smile: ).

Bart, I tried out with one of my tables but could not reproduce.
Say I have a working table with a primary key called shapes, I did
something like:

create table shapesnopk as select * from shapes
insert into USER_SDO_GEOM_METADATA select 'SHAPESNOPK', COLUMN_NAME,
DIMINFO, SRID from user_sdo_geom_metadata where table_name = 'SHAPES'

This way I created a spatial clone with no pk, which I then queried
with wfs:

http://localhost:8080/geoserver/wfs?service=WFS&amp;request=GetFeature&amp;typeName=topp:SHAPESNOPK

and the fids I got back looked like:
shapesnopk.nfm--25fa8814_1163e66b9c2_-8000

So it works for me, with the latest nightly. Are you sure that table
really has no pk?
Cheers
Andrea