Bug report #20831

Range widget does not honor default value on not null column

Added by Hugo Mercier over 5 years ago. Updated about 5 years ago.

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

Related to QGIS Application - Bug report #19671: The Ok button for the form dialog is disabled for NOT NUL... Open 2018-08-22

Associated revisions

Revision eb5a3367
Added by Hugo Mercier about 5 years ago

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.

Revision fa1f8762
Added by Hugo Mercier about 5 years ago

Merge pull request #9033 from mhugo/fix_20831

Fix "Allow null" in range widget (fixes #20831)

Revision ef1634c8
Added by Hugo Mercier about 5 years ago

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 over 5 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 about 5 years ago

  • Assignee set to Hugo Mercier

#3 Updated by Hugo Mercier about 5 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF