Bug report #20831
Range widget does not honor default value on not null column
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | Hugo Mercier | ||
Category: | Forms | ||
Affected QGIS version: | 3.4.2 | Regression?: | No |
Operating System: | linux | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 28650 |
Description
On a layer with a numeric primary key, QGIS enforces a not null constraint.
We may expect to circumvent this constraint with a default value. With the default "Range" widget however, the default value is not taken into account and there is no way to validate the form without manually entering a non null value.
However with the "Text Edit" widget, the default value is correctly taken.
Related issues
Associated revisions
Fix "Allow null" in range widget (fixes #20831)
By default a range widget is built with a minimum value set to the
minimal integer that is possible to represent. When "allow null" is
enabled, a new value (minvalue - 1) is inserted. With the default
value, we then had an integer overflow.
Fix "Allow null" in range widget (fixes #20831)
By default a range widget is built with a minimum value set to the
minimal integer that is possible to represent. When "allow null" is
enabled, a new value (minvalue - 1) is inserted. With the default
value, we then had an integer overflow.
(cherry picked from commit eb5a3367b651e8a7d83af4af41ea0f481efc126b)
History
#1 Updated by Hugo Mercier almost 6 years ago
- Related to Bug report #19671: The Ok button for the form dialog is disabled for NOT NULL Postgres columns added
#2 Updated by Hugo Mercier almost 6 years ago
- Assignee set to Hugo Mercier
#3 Updated by Hugo Mercier almost 6 years ago
- % Done changed from 0 to 100
- Status changed from Open to Closed
Applied in changeset qgis|eb5a3367b651e8a7d83af4af41ea0f481efc126b.