[GRASS-user] Change the length and type of columns in an attribute table

Markus Metz markus.metz.giswork at gmail.com
Thu Apr 5 05:41:21 PDT 2018


On Wed, Apr 4, 2018 at 5:54 PM, Camille Bezzina <camille.bezzina at geophom.fr>
wrote:
>
> Hello all,
>
>
> I have a problem when I want to modify an attribute table.
>
> I add a new vector with v.in.ogr. My attribute table is build like that :
>
> name                   type                              length
>
> cat                      integer                           20
> ID                       character                       24
> PREC_PLANI       double precision             20
> NATURE              character                       31
> HAUTEUR           integer                            20
> id_2                    integer                            20
>
>
> I would like to remove the column 'HAUTEUR', but when I remove this
> column, my two character columns (ID and NATURE) change automatically to
> become :
>
> ID                   text        1000
> NATURE         text        1000
>
> Do you know why the simple fact to remove a column (HAUTEUR) change type
> and length of other columns.

The reason is that GRASS uses SQLite as database manager, and in SQLite
there is nothing like varchar(24), only text without any length
restrictions. That means, when importing vector data with attributes, any
text fields are converted to text by SQLite itself. The value 1000 as
length for text is somewhat misleading here because the maximum allowed
length in SQLite is by default 1 billion.

Markus M
>
> Thanks,
> --
>
> Camille BEZZINA
> Chargé d'études géomatiques et photomontages
> Geophom
> 57 rue du Chemin Neuf 44521 OUDON
> Standard: +33(0)2 85 52 02 59
> Ligne directe: +33(0)9 72 56 81 71
> www.geophom.fr
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180405/16a6a75a/attachment.html>


More information about the grass-user mailing list