Skip to content
Permalink
Browse files

Don't alter the field specification for types other than real

Fixes #37254
  • Loading branch information
jdugge authored and nyalldawson committed Jun 19, 2020
1 parent 3dd267c commit 9b53ca645c57ea86890da24bae6a80ac68141f12
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/core/providers/ogr/qgsogrprovider.cpp
@@ -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() );

0 comments on commit 9b53ca6

Please sign in to comment.
You can’t perform that action at this time.