Bug report #18679
Cannot insert decimal separator to field
|Affected QGIS version:||3.0.0||Regression?:||No|
|Operating System:||Windows 7 64 bit||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||26567|
Hi, I have PostGIS based layer with numeric field. When i try to edit this field, it is not posible to insert (copy nor write) numbers with decimal separator. Only integer values are alowed. I try use dot as well as comma but with no luck. Also tried to switch QGIS language from United States to my system locale (Czech), but this also didn't work.
Postgres field definition is plain numeric (no scale a precision defined)
QGIS field definition said: double, numeric, -1, -1
It works fine in 2.18.14 (with dot or even comma). Same database, same table, same field.
#1 Updated by Alessandro Pasotti over 2 years ago
- Status changed from Open to Feedback
- Assignee set to Alessandro Pasotti
I cannot reproduce in current master, would you be able to test a nightly build?
If that still does not work, please attach a minimal project and data (pg_dump) to reproduce the issue.
#2 Updated by David Pavlicek over 2 years ago
I have tested this against latest nightly build from OSGeo (3.1.0-master 4c8b1595a9) with same results...
BUT, after bit of fiddling with this, I thing that real isuue is how editing plugin handles decimal number fields without scale and precision in conjunction with system (Windows) decimal separator settings. When I try to edit decimal number with -1 in scale and precision and with comma (,) as system decimal separator, it does not work! No matter of source layer type (tested with Postgres, shape and memory layer). There is matrix of all data types I have tested with comma as system decimal separator:
numeric(10,5) - WORKS
numeric(-1,-1) - BROKEN
decimal(10,5) - WORKS
real(-1,-1) - BROKEN
double(-1, -1) - BROKEN
When I set system decimal separator to dot (.) everything works... Unfortunately, I cannot simply change my system settings permanently because there are lot of other applications and systems that expects comma as system decimal separator (it is default for my locale).
Hope this helps
#3 Updated by Alessandro Pasotti over 2 years ago
Thanks for the feedback,
So, basically, the problem looks like that the default editor widget for numeric does not take into account your operating system locale decimal separator setting?
How are the locale settings in QGIS options?
Would you mind attaching a small screenshot so that I'm sure we are looking to the same widget?
#4 Updated by David Pavlicek over 2 years ago
- File qgis_locale_setting.png added
- File layer_definition.png added
- File layer_form.png added
- File system_locale_stting.png added
There are screenshots of my system settings, QGIS settings, Layer definition and its Feature form where i try to put in 123.45 (123,45 respectively)...
#5 Updated by Alessandro Pasotti over 2 years ago
- Assignee deleted (
- Resolution set to not reproducable
Sorry: I tested this again but I wasn't able to reproduce it on Linux with latest master: I also have "," as a decimal separator and I'm testing with a PostGIS DB with a "numeric" "-1" "-1" field configuration (just like your attached images).
What happens in my tests is that I can enter a number with both (. and ,) as decimal separator: whenever I press a "," it gets automatically converted to a ".".
#15 Updated by Alessandro Pasotti over 2 years ago
- Status changed from Open to Closed
- Resolution changed from not reproducable to fixed/implemented
Fixed with https://github.com/qgis/QGIS/commit/4e37f381dee1e8a54144776c55bedbdf4df14b9b
please test it and report any issue assigning it to me