[Qgis-developer] addFeatures without knowing new feature's id, bug?
Denis Rouzaud
denis.rouzaud at gmail.com
Mon Jan 16 07:04:01 EST 2012
Hi again!
I am trying to add a feature to a PostGIS table, in which there is a
serial primary key 'id'.
Without defining id, here is what I get when I try addFeatures:
ERROR: null value in column "id" violates not-null constraint
and I tried
iid = self.layer.dataProvider().fieldNameIndex('id')
if iid != -1:
f.addAttribute(iid,'nextval(distribution.dimension_id_seq::regclass)')
which leaded to
ERROR: invalid input syntax for integer:
"nextval(distribution.dimension_id_seq::regclass)"
Is there a bug in the provider, or should I get first the new id (if
yes, how do I do this) ?
Thanks a lot!
Denis
More information about the Qgis-developer
mailing list