[QGIS-Developer] [REGRESSION] Error inserting in a PostGIS view

Matthias Kuhn 🌍 matthias at opengis.ch
Thu May 11 09:09:46 PDT 2017


Hi Paolo,

QGIS 2.18 expects a view to return the newly created row including
values generated server side. This way the primary key of a newly
created feature can directly be used (e.g. to set the foreign key of
another feature).

So, this is definitely a feature and not a bug ;)

What you can do

 - Update the views to RETURN the new record ([1])

 - Find a way to determine if a view/table returns something, so we can
    conditionally only request this when it really is available

 - Propose a different approach / better solution

Sorry for the inconvenience
Matthias

[1] https://github.com/QGEP/datamodel/blob/master/view/vw_channel.sql#L133


On 05/11/2017 05:09 PM, Paolo Cavallini wrote:
> Hi all,
> with QGIS 2.18, when inserting records in a versioned view, created with
> DB Manager, I receive an error:
> 
> ERROR: cannot perform
> INSERT RETURNING on relation "version_current"
> 
> HINT: You need an unconditional ON INSERT DO INSTEAD rule with a
> RETURNING clause.
> 
> The same operation on the same view works smoothly on QGIS 2.14.
> Could anyone confirm the regression?
> All the best, and thanks.
> 


More information about the QGIS-Developer mailing list