[Geoserver-users] Problem with publishing data into postgis

Hello group,

We’re using geoserver’s (2.5.1) REST api to publish data to a postgis database. This is working well, but in some circumstances the data is not processed. I found out that when a transaction in postgres is canceled and roll-backed due to constraint violations or wrong datatypes, geoserver still returns a http 201 status.

Is there a way to get an error message when this happens?

regards,

Dirk-Jan

=================
Example:

Table test with constraint:

ALTER TABLE tbl_test
ADD CONSTRAINT test_constraints
CHECK (name = lower(name));

Attribute data shapefile:

id name
2 DEF
1 ABC

curl -u admin:geoserver -v -XPUT -H “Content-type: application/zip” --data-binary @test.ziphttp://localhost:8080/geoserver/rest/workspaces/sf/datastores/pg/file.shp?update=overwrite

response:

  • Hostname was NOT found in DNS cache
  • Trying 127.0.0.1…
  • Connected to localhost (127.0.0.1) port 8080 (#0)
  • Server auth using Basic with user ‘admin’

PUT /geoserver/rest/workspaces/sf/datastores/pg/file.shp?update=overwrite HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.35.0
Host: localhost:8080
Accept: /
Content-type: application/zip
Content-Length: 1645
Expect: 100-continue

< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< Date: Tue, 08 Jul 2014 09:52:54 GMT

  • Server Noelios-Restlet-Engine/1.0…8 is not blacklisted
    < Server: Noelios-Restlet-Engine/1.0…8
    < Transfer-Encoding: chunked
    <
  • Connection #0 to host localhost left intact

Database log:
2014-07-08 11:52:53 CEST ERROR: new row for relation “tbl_test” violates check constraint “test_constraints”
2014-07-08 11:52:53 CEST DETAIL: Failing row contains (3, 010100002040710000DA4E04AAE2CD0041CF8B333E4EB31A41, 2, DEF).
2014-07-08 11:52:53 CEST STATEMENT: INSERT INTO “public”.“tbl_test” ( “the_geom”,“id”,“name” ) VALUES ( ST_GeomFromText(‘POINT (137660.33301602938 437459.5607435079)’, 28992),2,‘DEF’)