Skip to content


Check if we have a numeric value before stripping the group separator
Browse files Browse the repository at this point in the history
Fix #20200 - wrong sequence detection under postgres

This is to avoid stripping out the dot from nextval
when schema is not public and locale has a dot
decimal separator.
  • Loading branch information
elpaso committed Oct 24, 2018
1 parent 0e5627c commit 797911e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gui/editorwidgets/qgstexteditwrapper.cpp
Expand Up @@ -229,8 +229,13 @@ void QgsTextEditWrapper::setWidgetValue( const QVariant &val )
// For numbers, remove the group separator that might cause validation errors
// when the user is editing the field value.
// We are checking for editable layer because in the form field context we do not
// want to strip the separator unless the layer is editable
if ( layer() && layer()->isEditable() && ! QLocale().groupSeparator().isNull() && field().isNumeric() )
// want to strip the separator unless the layer is editable.
// Also check that we have something like a number in the value to avoid
// stripping out dots from nextval when we have a schema: see
// "Wrong sequence detection with Postgres"
bool canConvertToDouble;
QLocale().toDouble( v, &canConvertToDouble );
if ( canConvertToDouble && layer() && layer()->isEditable() && ! QLocale().groupSeparator().isNull() && field().isNumeric() )
v = v.remove( QLocale().groupSeparator() );
Expand Down

0 comments on commit 797911e

Please sign in to comment.