Skip to content

Commit

Permalink
Don't alter the field specification for types other than real
Browse files Browse the repository at this point in the history
Fixes #37254
  • Loading branch information
jdugge authored and nyalldawson committed Jun 19, 2020
1 parent 3dd267c commit 9b53ca6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -1886,7 +1886,8 @@ bool QgsOgrProvider::addAttributeOGRLevel( const QgsField &field, bool &ignoreEr

gdal::ogr_field_def_unique_ptr fielddefn( OGR_Fld_Create( textEncoding()->fromUnicode( field.name() ).constData(), type ) );
int width = field.length();
if ( field.precision() )
// precision is only meaningful for OFTReal, don't alter the specified width for other types
if ( type == OFTReal && field.precision() )
width += 1;
OGR_Fld_SetWidth( fielddefn.get(), width );
OGR_Fld_SetPrecision( fielddefn.get(), field.precision() );
Expand Down

0 comments on commit 9b53ca6

Please sign in to comment.