Can you use SQL Views in Geoserver to insert a new database record into a PostGis Datastore?

Viewed 193

I have tried to make an entry into a PostGIS Store in Geoserver using a SQL View in Geoserver with the following statement:

INSERT INTO marker_shp(gid, id, geom)
VALUES ((SELECT max(gid) FROM marker_shp)+1, (SELECT max(id) FROM marker_shp)+1, ST_GeomFromText('POINT (499724.5561430572 5268410.813606716)', 32633))

I got the following error message:

ERROR: Syntax error at »INTO« Position: 23

However, the same Query works fine if I use the same SQL Statement in pgAdmin.

If someone could help me out here I would be very thankful.

All the best: Thomas :)

1 Answers

The syntax should be

 INSERT INTO marker_shp(gid, id, geom) 
 SELECT max(gid) ,  max(id)+1 F,  ST_GeomFromText('POINT (499724.5561430572 5268410.813606716)', 32633))
 FROM marker_shp
Related