[Geoserver-devel] Updatable Postgis Views with WFS and Geoserver

Antonello Parente ha scritto:

Dear Andrea
I have insert and update rules. I can Insert and Update via SQL in my view but geoserver doesn't work because there is no primary key...

(please keep the mailing list in the loop).

Right, I see... is it possible to declare indexes on top of views?
Alternatively, is there any database level metadata that can be
set to indicate the "unique" column in the view? (e.g., can a
unique index be declared on the view for example)

Cheers
Andrea

Il giorno 17/ott/2009, alle ore 02.15, Andrea Aime ha scritto:

Antonello Parente ha scritto:

dear Geoserver USERS,
I have 3 postgis tables that collect informations about points of interest.
I make an updatable view on these tables to implement a Geoserver layer.
The visualization of these points works fine, but when i try to insert new features, thought WFS, it trows this exception: "the name_layer_from_myview is read only".
The problem is that a view doesn't have a primary key definition.
Is that a geoserver limitation?

You can think of it as a GS limitation or a Postgres limitation.
GeoServer cannot do joining on its own, if it could, it would
probably be able to split up the insert statement over the
origination table. But... it's not.

At the same time in other databases (Oracle) certain types of views
are updatable and can have primary keys, and GeoServer WFS-T works
fine on them.

How I can solve the problem?

Also expose the flat tables and run the WFS-T commands directly on
top of them.
Alternatively I think you can create update/insert rules for the
view but I have no experience on the topic. You can find some
info here:
http://www.postgresql.org/docs/8.1/interactive/rules-views.html
http://www.psql.it/ml_archive/msg00590.html

Cheers
Andrea