Bug report #14163

processing: datetime fields converted to date (time data loss) when saved to memory layer

Added by Mathieu Pellerin - nIRV over 4 years ago. Updated over 4 years ago.

Assignee:Victor Olaya
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:22165


Applying an algorithm to a layer which contains a datetime field will result in an ouput that transforms the datetime field into a date-only field, causing time data loss. While a shapefile only supports date field, the memory layer does (as soon as https://github.com/qgis/QGIS/pull/2713 is merged) support datetime field, it'd be nice for processing to preserve datetime when the output if a memory layer.

test.gpx (1.25 KB) Mathieu Pellerin - nIRV, 2016-01-27 12:17 AM

Associated revisions

Revision 427b9c97
Added by Mathieu Pellerin - nIRV over 4 years ago

[processing] add date, datetime, time fields to memory output
(fixes #14163)


#1 Updated by Alexander Bruy over 4 years ago

Processing copies fields definition from source layers, so If layer reports field as DateTime and output format/provider supports this data type without conversion it should just work

#2 Updated by Mathieu Pellerin - nIRV over 4 years ago

Alex, it does not over here :) Here's an easy set of steps to reproduce the loss of datetime field:
  1. Create a new project
  2. Add the attached test.gpx vector file (choose the track_points layer)
  3. Open the layer properties window, and take note of the "time" field, identified as a DateTime field type
  4. Open processing, and select the "Fixed distance buffer" algorithm
  5. Save the resulting buffer to a memory layer
  6. Open the layer properties window for the newly created buffer memory layer, and take note of the "time" field, converted to a String field type

#3 Updated by Mathieu Pellerin - nIRV over 4 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF