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

Victor Olaya volayaf at gmail.com
Fri Feb 6 03:54:20 PST 2015


Correct, no PK in my table. What you say sounds feasible. I will try
with another table that has a PK, and see if I can reproduce the error
or not.

I cannot expect to have a PK in the user's table, but this is at least
a clue :-)

Thanks!

2015-02-06 12:48 GMT+01:00 Martin Dobias <wonder.sk at gmail.com>:
> 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
>


More information about the Qgis-developer mailing list