[GRASS-user] Change SQLite DB Column Width?

Even Rouault even.rouault at spatialys.com
Sat Aug 5 09:11:21 PDT 2017


On vendredi 4 août 2017 16:22:57 CEST Jeshua Lacock wrote:
> > On Aug 4, 2017, at 2:03 AM, Even Rouault <even.rouault at spatialys.com>
> > wrote:
> > 
> > As column width is just a hint in SQLite and has no influence on the
> > database structure (you can insert fields that are longer than the
> > declared size), you can just edit the sqlite_master table (which is
> > generaly a dangerous game, and must be done only when you know what you
> > are doing)
> > 
> > With the sqlite3 shell :
> > 
> > PRAGMA writable_schema = 1;
> > UPDATE SQLITE_MASTER SET SQL = 'CREATE TABLE
> > TrailSegment_12(column_definitions_before_name, NAME CHARACTER(128),
> > column_definitions_after_name) ' WHERE NAME = 'TrailSegment_12'; PRAGMA
> > writable_schema = 0;
> > 
> > so basically get the existing SQL definitions of the table with "SELECT
> > SQL FROM SQLITE_MASTER WHERE NAME = 'TrailSegment_12'", edit it to change
> > the column width, and put it in the above UPDAT
> Hi Even,
> 
> Thanks for your help.
> 
> If I could figure out exactly what you mean, I think this might be the most
> elegant solution.
> 
> But when I run:
> 
> sqlite> SELECT sql FROM sqlite_master WHERE type = 'TrailSegment_12’;

The condition is name = 'TrailSegment_12' not type =

> sqlite>
> 
> It doesn’t display anything and just returns to the sqlite prompt.
> 
> 
> 
> Best,
> 
> Jeshua Lacock
> Founder/Engineer
> <3DTOPO.com>
> GlassPrinted.com


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20170805/ce939fc3/attachment.html>


More information about the grass-user mailing list