#2834: v.db.select comand works, sqlite, attribute table does not open
--------------------------+-------------------------
Reporter: khe | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.0.3
Component: Database | Version: 7.0.2
Resolution: | Keywords: v.in.ogr
CPU: Unspecified | Platform: Linux
--------------------------+-------------------------
Comment (by mlennert):
I can confirm your error with the trail shapefile, although for me
v.db.select also fails:
{{{
v.db.select
trailcat|object_id|gml_id|objektart|objektname|funktion_i|funktion_n|befestigun|befestig_1|art_id|art_name|breite|eigenname|kennung|gml_id_unt|unten_name|klasse|beginn|ende|SHAPE_STLe
DBMI-SQLite erreur de pilote :
Unable to scan date:
DBMI-SQLite erreur de pilote :
Unable to scan date:
ERREUR :Unable to fetch data from table <trail>
}}}
Setting DEBUG to 3 I get the following:
{{{
[...]
D3/3: col: SHAPE_STLe, nkcols 19, litetype : 2, sqltype 6
cat|object_id|gml_id|objektart|objektname|funktion_i|funktion_n|befestigun|befestig_1|art_id|art_name|breite|eigenname|kennung|gml_id_unt|unten_name|klasse|beginn|ende|SHAPE_STLe
D3/3: fetch row = -1
D3/3: col 0, litetype 1, sqltype 3: val = '1'
D3/3: col 1, litetype 3, sqltype 1: val =
'0c6d5762-d8cb-4554-a559-45010a046a4d'
D3/3: col 2, litetype 3, sqltype 1: val = 'DEBWB0010000LRl3'
D3/3: col 3, litetype 1, sqltype 3: val = '42008'
D3/3: col 4, litetype 3, sqltype 1: val = 'Fahrwegachse'
D3/3: col 5, litetype 1, sqltype 3: val = '5211'
D3/3: col 6, litetype 3, sqltype 1: val = 'Hauptwirtschaftsweg'
D3/3: col 7, litetype 1, sqltype 3: val = '0'
D3/3: col 8, litetype 3, sqltype 1: val = ''
D3/3: col 9, litetype 1, sqltype 3: val = '0'
D3/3: col 10, litetype 3, sqltype 1: val = ''
D3/3: col 11, litetype 2, sqltype 6: val = '6.0'
D3/3: col 12, litetype 3, sqltype 1: val = '; ForstBW'
D3/3: col 13, litetype 3, sqltype 1: val = ''
D3/3: col 14, litetype 3, sqltype 1: val = 'DEBWB0010000BTEi'
D3/3: col 15, litetype 3, sqltype 1: val = 'Brücke'
D3/3: col 16, litetype 1, sqltype 3: val = '11190'
D3/3: col 17, litetype 3, sqltype 9: val = '2014-09-24'
D3/3: sqlite fetched date: <2014-09-24>
D3/3: col 18, litetype 3, sqltype 9: val = ''
D3/3: sqlite fetched date: <>
DBMI-SQLite erreur de pilote :
Unable to scan date:
DBMI-SQLite erreur de pilote :
Unable to scan date:
ERREUR :Unable to fetch data from table <trail>
}}}
I can see that there is a problem with the 19th column which is 'ende'.
The programme cannot read the column as a date. This column is empty, but
it is not considered as NULL (no value), but as '' (empty string value).
I tried setting the column explicitely to NULL using v.db.update:
{{{
v.db.update trail col=ende value=NULL
}}}
but I still get the same error with v.db.select.
However, when I set the column to NULL using db.execute
{{{
db.execute sql="UPDATE trail SET ende=NULL"
}}}
v.db.select runs as expected.
So, there seems to be a problem with the NULL handling. When I open the
shapefile in QGIS, the ende column values are all marked as 'NULL'.
Somehow, either v.in.ogr or the sqlite driver seems to create a confusion
between NULL and an empty string.
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2834#comment:9>
GRASS GIS <https://grass.osgeo.org>