[Qgis-developer] QgsField::length semantic

Sandro Santilli strk at kbt.io
Tue Oct 11 02:14:16 PDT 2016


Adding Arnaud to the loop, being the author of the PR which added
constrained numeric fields in PostgreSQL provider [1]

[1] https://github.com/qgis/qgis/commit/92f71b696ca93c792ae5602ed82863fcef0e5006

Arnaud: what was the reason for constraining that field ?
The semantic of QgsField's length and precision attributes
aren't fully defined and they seem not to match PostgreSQL
numeric relatives "precision" and "scale" [2]

[2]
https://www.postgresql.org/docs/9.5/static/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL

--strk;

On Tue, Oct 11, 2016 at 10:51:34AM +0200, Sandro Santilli wrote:
> On Tue, Oct 11, 2016 at 10:47:50AM +0200, Paolo Cavallini wrote:
> > Il 11 ottobre 2016 10:45:18 CEST, Sandro Santilli <strk at kbt.io> ha scritto:
> 
> > >Does anyone have an idea about how should QgsField::length be
> > >interpreted ?
> > 
> > Isn't it related to the comma being counted in real fields?
> 
> The bug ? Probably. QgsOgrProvider::convertField adds one byte
> for the comma while QgsPostgresProvider::convertField does not
> 
> But what I'd like to know is whether or not QgsField::length
> is supposed to count or not the comma (or what else is meant
> to be expressing) for a QVariant::Double and for other types.
> 
> --strk;
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list