Bug report #4742

postgres int8 not supported by addAttributes class

Added by Regis Haubourg almost 13 years ago. Updated over 10 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider
Affected QGIS version:master Regression?:No
Operating System:windows (others not tested) Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:14614

Description

Hi All,
when trying to add a field to a provider within API (python), if the source field is "int8" coming from a postgres provider, field is simply not added to target provider.

Here is the code :

field_list=[]
for v in source_layer.values():
field_list.append(v)
new_provider.addAttributes( field_list )
list_length = len(field_list) --> number of fields from postgres source = n OK
provider_fields_count = len(new_provider.fields()) --> number of fields of target provider after "addAttribute" = n-(n int8 fields) : KO. New int8 fields disappear

When work around this this way:

Could that be corrected inside :

field_list=[]
for v in layer_fields.values():
f = QgsField(v)
if (f.typeName() == "int8"):
v = QgsField( f.name(), QVariant.Int)
field_list.append(v)

Is it any know issue?
Cheers,
Régis

History

#1 Updated by Paolo Cavallini over 12 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0

#2 Updated by Paolo Cavallini about 12 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#3 Updated by Regis Haubourg over 10 years ago

  • Status changed from Open to Closed

Done in 2.0

Also available in: Atom PDF