Following on from this earlier question I'm on PostgreSQL 8.4 and am having trouble with updatable views.
I have a view:
CREATE VIEW filedata_view
AS SELECT num, id, ST_TRANSFORM(the_geom,900913) AS the_geom
FROM filedata
And want to update it from my application throw Geoserver. But get a error:
<ServiceExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ogc http://schemas.opengis.net/wfs/1.0.0/OGC-exception.xsd">
<ServiceException> {http://www.opengeospatial.net/cite}filedata_view is read-only </ServiceException>
</ServiceExceptionReport>
So views in PostgresSql are not updatable. I need create a rule or trigger to update the view.
I tried this:
CREATE OR REPLACE RULE ins_view_2 AS
ON UPDATE TO filedata_view DO INSTEAD UPDATE filedata SET the_geom=ST_TRANSFORM(NEW.the_geom,70066)
WHERE num=NEW.num
but it didn't help, I'm still getting the same error.
Where is my mistake?