Bug report #14775

Layer style 'Categorized' ignores default values before saving layer edits

Added by R. R. over 8 years ago. Updated over 7 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Unknown
Affected QGIS version:2.14.2 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:22732

Description

To reproduce this issue please create a new PostGIS layer and set a default value for one of the columns. Next, categorize the layer in the 'Layer properties' dialog using the column with the default value. When adding a new feature the default value is ignored before saving the layer edits. Therefore the added feature isn't rendered on the map canvas.

14775.mp4 (2.19 MB) R. R., 2016-05-05 12:46 PM

14775.png (172 KB) R. R., 2016-05-05 01:15 PM

14775_create_transaction_groups.mp4 (3.16 MB) R. R., 2016-05-09 11:54 AM

History

#1 Updated by R. R. over 8 years ago

#2 Updated by R. R. over 8 years ago

'Show Feature Count' ignores the newly added features, too.

#3 Updated by R. R. over 8 years ago

#4 Updated by R. R. over 8 years ago

See also #14783

#5 Updated by R. R. over 8 years ago

After enabeling 'Create transaction groups automatically whenever possible (Experimental)' in Settings/Options.../Data Sources some icons ('Save Layer Edits', 'Undo', 'Redo') are not available and 'Show Feature Count' is still not working properly. However, the default value issue seems to be solved.

#6 Updated by R. R. over 8 years ago

  • Status changed from Open to Closed

#7 Updated by Harrissou Santanna over 8 years ago

  • Status changed from Closed to Reopened

Hi,
Reinhard, I reopen this because user do not need to activate the auto transaction option to have their default value applied. If so, then it's a bug imho and should be properly fixed.

#8 Updated by Matthias Kuhn over 8 years ago

  • Status changed from Reopened to Closed
  • Resolution set to invalid

Users do need to activate this option because the value is generated database side and QGIS does not know what postgres will do after saving.
Transactional editing sends the features to postgres just in time and therefore gives faster visual feedback (at the expense of losing undo/redo functionality).

If this is a requirement

  • With current master (QGIS 2.16) there is a new option "Evaluate default values" which takes a different approach and already gets default values from the database before saving the feature
  • A new feature request could be opened to define default values via an "Expression"

#9 Updated by Jürgen Fischer over 7 years ago

  • Category set to Unknown

Also available in: Atom PDF