[Qgis-developer] Strange behaviour in feature ids when editing PostGIS layer

Martin Dobias wonder.sk at gmail.com
Fri Feb 6 03:48:58 PST 2015


Hi Victor

On Fri, Feb 6, 2015 at 5:39 PM, Victor Olaya <volayaf at gmail.com> wrote:

>
> In the case of a PostGIS layer, when the editingStopped signal is
> emitted, the query will return no features. The feature with id 1 is
> no longer there, and instead there will be a feature with id equal to
> 4. So basically it seems that a modification of a feature is really a
> removal and then an addition, and the added feature has a different id
> than the removed one,
>

 Does you table have a primary key? What is the table definition?

If the postgres provider can't find a primary key, it will try to use ctid
as the ID. Then I think what you say can happen - when updating a row,
postgres removes the old row and appends a new one and the ctid will change.

Cheers
Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20150206/e046f158/attachment.html>


More information about the Qgis-developer mailing list