[GRASS-dev] [GRASS GIS] #578: quote column names to avoid SQL reserved word collision

#578: quote column names to avoid SQL reserved word collision
---------------------------+------------------------------------------------
Reporter: hamish | Owner: grass-dev@lists.osgeo.org
     Type: enhancement | Status: new
Priority: minor | Milestone: 7.0.0
Component: Vector | Version: svn-develbranch6
Keywords: v.in.ogr, SQL | Platform: All
      Cpu: All |
---------------------------+------------------------------------------------
Hi,

moved here from GDAL bug # 2965
http://trac.osgeo.org/gdal/ticket/2965

v.in.ogr will not read GPX format as input because OGR's GPX driver
creates a DB field called "time" for the timestamp. GRASS chokes on this
because TIME is a SQL reserved word for some backends (DBF doesn't like
it, SQLite is ok with it).

workaround: use the cnames= option to rename the TIME field.

suggestion by rouault:
"''There is no reason for the GPX driver not to use "time" as a field
name. I think you should report it rather to the GRASS project. They
should likely quote the field names (provided that it supports that). This
is what the PG and MySQL driver in OGR do, so you can use any name, even
if it is a SQL reserved keyword.''"

comments?

Hamish

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

#578: quote column names to avoid SQL reserved word collision
---------------------------+------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: minor | Milestone: 7.0.0
Component: Vector | Version: svn-develbranch6
Keywords: v.in.ogr, SQL | Platform: All
      Cpu: All |
---------------------------+------------------------------------------------

Comment(by neteler):

For SQL reserved word collisions, see also #1755

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

#578: quote column names to avoid SQL reserved word collision
---------------------------+------------------------------------------------
Reporter: hamish | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: minor | Milestone: 7.0.0
Component: Vector | Version: svn-develbranch6
Keywords: v.in.ogr, SQL | Platform: All
      Cpu: All |
---------------------------+------------------------------------------------

Comment(by mlennert):

Replying to [ticket:578 hamish]:

> suggestion by rouault:
> "''There is no reason for the GPX driver not to use "time" as a field
name. I think you should report it rather to the GRASS project. They
should likely quote the field names (provided that it supports that). This
is what the PG and MySQL driver in OGR do, so you can use any name, even
if it is a SQL reserved keyword.''"
>
>
>
> comments?

IMHO, quoting of field names is good practice in general, and so should be
implemented in GRASS is possible.

Moritz

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