[GRASS-dev] [GRASS GIS] #1755: cannot create sqlite table for v.net.centrality

#1755: cannot create sqlite table for v.net.centrality
------------------------------+---------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: unspecified
Keywords: v.net.centrality | Platform: Unspecified
      Cpu: Unspecified |
------------------------------+---------------------------------------------
I just tried v.net.centrality so I could present it to class tomorrow.
Apparently it is broken.

I got the error:

v.net.centrality input=roads_nodes@spatialtech2012 alayer=1 nlayer=2
output=roads_cent degree=degree closeness=close betweenness=between
eigenvector=eigenvect
DBMI-SQLite driver error:
Error in sqlite3_prepare():
near "between": syntax error
ERROR: Unable to create table: 'create table roads_cent(cat integer,
degree double precision, close double precision, between double precision,
eigenvect double precision)'
(Thu Oct 4 22:10:04 2012) Command finished (0 sec)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1755&gt;
GRASS GIS <http://grass.osgeo.org>

#1755: cannot create sqlite table for v.net.centrality
------------------------------+---------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: unspecified
Keywords: v.net.centrality | Platform: Unspecified
      Cpu: Unspecified |
------------------------------+---------------------------------------------

Comment(by martinl):

Replying to [ticket:1755 cmbarton]:
> near "between": syntax error
> ERROR: Unable to create table: 'create table roads_cent(cat integer,
degree double precision,

'between' is a reserved word for SQLite and other DB backends.

ps: please could you use preformatted text in your reports, otherwise it's
hard to read - [wiki:WikiFormatting]

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1755#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1755: cannot create sqlite table for v.net.centrality
------------------------------+---------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: unspecified
Keywords: v.net.centrality | Platform: Unspecified
      Cpu: Unspecified |
------------------------------+---------------------------------------------

Comment(by marisn):

There is an old request to quote column names that would allow to use SQL
reserved words as column names. See more: #578

Second option would be to enhance parser to discard SQL reserved words as
valid column parameters. AFAIK SQL-92 reserved word list isn't so long.
Yes, I know, somebody will scream that PG, MySQL etc. have extra reserved
words etc., still even blocking only the most common ones would make day
for a user like Michal much better as he would be able to finish his task
instantly instead of writing a bug report.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1755#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1755: Need error message to indicate reserved words in SQLite
------------------------------+---------------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: unspecified
Keywords: v.net.centrality | Platform: Unspecified
      Cpu: Unspecified |
------------------------------+---------------------------------------------
Changes (by cmbarton):

  * type: defect => enhancement

Comment:

I relooked at the error and I'm not as unobservant as I initially assumed.
There is nothing to say that "between" is an SQLite reserved word. So
thanks for the clue about what is wrong.

This is not a bug. But maybe an enhancement request for better error
messages here. Changing the field name to "betw" makes it work fine. I've
changed the summary too. I don't know if the component should stay vector
or shift to something else.

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1755#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1755: Need error message to indicate reserved words in SQLite
-----------------------------------+----------------------------------------
Reporter: cmbarton | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.0.0
Component: Vector | Version: unspecified
Keywords: v.net.centrality, SQL | Platform: Unspecified
      Cpu: Unspecified |
-----------------------------------+----------------------------------------
Changes (by neteler):

  * keywords: v.net.centrality => v.net.centrality, SQL

Comment:

For SQL reserved word collisions, see also #578

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1755#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>