Opened 10 years ago

Last modified 5 years ago

#2322 new defect

v.db.addtable: add sanity check to avoid unreadable column types with SQLite

Reported by: neteler Owned by: grass-dev@…
Priority: normal Milestone: 7.6.2
Component: Database Version: svn-releasebranch70
Keywords: v.db.addtable, SQLite Cc:
CPU: Unspecified Platform: Unspecified

Description

Given that SQLite accepts "whatever" type which is eventially unreadable:

# Example: GRASS 7.1.svn (nc_spm_08_grass7):~ >
echo "527500.0|165000.0|1" | v.in.ascii input=- output=testpoint

# nonsense type is accepted as being passed on to SQLite:
v.db.addtable testpoint layer=2 columns="name something"
DB settings already defined, nothing to do
Reading features...
 100%
Updating database...
 100%
0 categories read from vector map (layer 2)
0 records updated/inserted (layer 2)

# re-opening fails since "something" cannot be remapped
# to GRASS DB types:
v.info -c testpoint layer=2
Displaying column types/names for database connection of layer <2>:
WARNING: SQLite driver: unable to parse decltype: something
WARNING: SQLite driver: unable to parse decltype: something
WARNING: SQLite driver: column 'name', SQLite type 2 is not supported
INTEGER|cat

Ouch. The issue came up while creating "mycol doubleprecision" instead of "mycol double precision".

A solution might be to re-open the table immediately in v.db.addtable and delete it right away if not readable to avoid that the user gets stuck with a broken table.

Ideas?

Change History (5)

comment:1 by martinl, 8 years ago

Milestone: 7.0.07.0.5

comment:2 by neteler, 8 years ago

Milestone: 7.0.57.0.6

comment:3 by neteler, 6 years ago

Milestone: 7.0.67.0.7

comment:4 by martinl, 5 years ago

Milestone: 7.0.77.6.1

comment:5 by martinl, 5 years ago

Milestone: 7.6.17.6.2

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.