Using python, I want to add a feature into a postgis layer that has a PK generated by a sequence.
layer (id [PK], field1, field2)
with edit(layer):
fields = layer.pendingFields()
new_feat = QgsFeature(fields)
new_feat[1] = 'text1'
new_feat[2] = 'text2'
layer.addFeatures([new_feat])
But I get an error saying the value is too long for the type of the id attribute
Question: How can I assign the next value of the postgis sequence to the id?
with edit(layer):withlayer.startEditing()– firefly-orange Mar 02 '18 at 15:48