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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

pcav
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.
--
Paolo Cavallini - www.faunalia.eu
QGIS & PostGIS courses: http://www.faunalia.eu/training.html
https://www.google.com/trends/explore?date=all&geo=IT&q=qgis,arcgis
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: [REGRESSION] Error inserting in a PostGIS view

Matthias Kuhn 🌍
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.
>
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: [REGRESSION] Error inserting in a PostGIS view

pcav
In reply to this post by pcav
Il 11/05/2017 17:09, Paolo Cavallini ha scritto:

> 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?

For the record: issue confirmed on other two DB, ticket opened:
https://issues.qgis.org/issues/16552
I'm available for further checking.
All the best.

--
Paolo Cavallini - www.faunalia.eu
QGIS & PostGIS courses: http://www.faunalia.eu/training.html
https://www.google.com/trends/explore?date=all&geo=IT&q=qgis,arcgis
_______________________________________________
QGIS-Developer mailing list
[hidden email]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer