[Geoserver-users] Controlling PK ID with WFS-T Insert?

Hi everyone,

I’m having some trouble trying to get a WFS-T Insert request to work to control the PK ID.

In the simplest scenario, I have a PostGIS database with a table created the following way: create table abc (id int primary key, geom geometry);

In Geoserver I have created a workspace test (with URI test), and a store called postgis which links to my postgis database. I’m able to publish the abc layer fine. I’ve also ticked the “expose primary key” box, and I assumed that would allow control over the PK ID column…

Now when I go to Demos I attempt using the following to issue a WFS-T Insert request:

<wfs:Transaction service=“WFS” version=“1.0.0”
xmlns:wfs=“http://www.opengis.net/wfs
xmlns:test=“test”
xmlns:gml=“http://www.opengis.net/gml
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=“http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd”>
wfs:Insert
test:abc
test:geom
<gml:MultiLineString srsName=“http://www.opengis.net/gml/srs/epsg.xml#4326”>
gml:lineStringMember
gml:LineString
<gml:coordinates decimal=“.” cs=“,” ts=" ">
494475.71056415,5433016.8189323 494982.70115662,5435041.95096618
</gml:coordinates>
</gml:LineString>
</gml:lineStringMember>
</gml:MultiLineString>
</test:geom>
test:id900</test:id>
</test:abc>
</wfs:Insert>
</wfs:Transaction>

I am not sure using test:id was the correct way to access this, but it doesn’t work. It simply increments the id, so starts with 1, then 2, then 3, etc. It doesn’t set it to 900.

The only thing I can think of is possibly using metadata tables? I can’t find anything in the documentation about what I am specifically trying to do, though there is some on the metadata tables. I don’t know if that’s required or not, though.

Any ideas on this?

Regards,
Travis

···

Travis Brundage
Software Engineer | Boundless
tbrundage@anonymised.com
250.888.2820
@boundlessgeo