[Geoserver-devel] [JIRA] (GEOS-9135) failed insert feature by wfs-t on table with unique guid primary key

alexandr bobrov created an issue

GeoServer / BugGEOS-9135

failed insert feature by wfs-t on table with unique guid primary key

Issue Type:

BugBug

Affects Versions:

2.14.2

Assignee:

Unassigned

Attachments:

geoserver.log

Components:

WFS

Created:

27/Feb/19 12:47 PM

Environment:

Windows 10 pro 64, PostgreSQL 10.1, postgis 2.4.2, geoserver 14.2, jre 1.8.0.102

Priority:

MediumMedium

Reporter:

alexandr bobrov

There is table in postgresql with postgis spatial column and guid primary key.

CREATE TABLE if not exists sssss (
	id uuid NOT NULL default uuid_in(md5(random()::text || now()::text)::cstring),
	"geom" "geometry",
	CONSTRAINT pk_sssss PRIMARY KEY (id)
);

I inserted record by sql with success result. I trying inserting with alredy seted identifer and also trying to generate identifier by default value.

INSERT INTO sssss ( geom ) VALUES ( '0101000020E61000000000000000003E400000000000004E40' );
INSERT INTO sssss ( id, geom ) VALUES ( '510de56d-654e-43d0-9f0c-537410e1b9c0', '0101000020E61000000000000000003E400000000000004E40' ) on conflict (id) do nothing ;

I tryed to execute wfs getFeature request
http://127.0.0.1:8083/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=te:sssss
And answer were ok.

<?xml version="1.0" encoding="UTF-8"?>
<wfs:FeatureCollection xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:te="gisbis" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" numberOfFeatures="2" timeStamp="2019-02-27T11:15:58.814Z" xsi:schemaLocation="http://www.opengis.net/wfs http://127.0.0.1:8083/geoserver/schemas/wfs/1.1.0/wfs.xsd gisbis http://127.0.0.1:8083/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=te%3Asssss">
  <gml:featureMembers>
    <te:sssss gml:id="sssss.510de56d-654e-43d0-9f0c-537410e1b9c0">
      <te:geom>
        <gml:Point srsName="urn:x-ogc:def:crs:EPSG:4326" srsDimension="2">
          <gml:pos>60 30</gml:pos>
        </gml:Point>
      </te:geom>
    </te:sssss>
    <te:sssss gml:id="sssss.e96dd199-2eb5-ab84-5a62-25fa9f81a2fe">
      <te:geom>
        <gml:Point srsName="urn:x-ogc:def:crs:EPSG:4326" srsDimension="2">
          <gml:pos>60 30</gml:pos>
        </gml:Point>
      </te:geom>
    </te:sssss>
  </gml:featureMembers>
</wfs:FeatureCollection>

But when I had try to insert feature by wfs-t, then I got error.
http://127.0.0.1:8083/geoserver/ows

<?xml version="1.0" encoding="UTF-8"?><wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
  <wfs:Insert>
    <feature:sssss xmlns:feature="te">
      <feature:geom>
        <gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="urn:ogc:def:crs:EPSG::4326">
          <gml:pos>60 30</gml:pos>
        </gml:Point>
      </feature:geom>
    </feature:sssss>
  </wfs:Insert>
</wfs:Transaction>

error answer:

<?xml version="1.0" encoding="UTF-8"?><ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://127.0.0.1:8083/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
  <ows:Exception exceptionCode="InvalidParameterValue">
    <ows:ExceptionText>Error performing insert: Cannot generate key value for column of type: java.util.UUID</ows:ExceptionText>
  </ows:Exception>
</ows:ExceptionReport>

Also I had change option in storage “expose primary keys” in true or false, but it did not get result.

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100098-sha1:2c6be9a)

Atlassian logo