[GRASS-dev] [GRASS GIS] #3563: v.in.ogr can't create tables in GRASS 7.4

GRASS GIS trac at osgeo.org
Wed May 16 14:35:37 PDT 2018


#3563: v.in.ogr can't create tables in GRASS 7.4
----------------------------+-------------------------
  Reporter:  pierreroudier  |      Owner:  grass-dev@…
      Type:  defect         |     Status:  new
  Priority:  normal         |  Milestone:
 Component:  Vector         |    Version:  7.4.0
Resolution:                 |   Keywords:
       CPU:  Unspecified    |   Platform:  Unspecified
----------------------------+-------------------------

Comment (by pierreroudier):

 Replying to [comment:1 hellik]:
 > >ORDER: Real (0.0)
 >
 > Order may be a SQL reserved word. try to rename it before

 Thanks -- that was indeed the problem! (This goes to show how limited my
 knoywledge of SQL is).

 It would maybe pay off to put a warning about this in the v.in.ogr
 documentation for users who like me don't do SQL very well.

 This is a patch that tries to address this:


 {{{
 --- v.in.ogr.html       2018-05-17 09:20:57.587213200 +1200
 +++ v.in.ogr-pr.html    2018-05-17 09:30:55.141497148 +1200
 @@ -411,19 +411,41 @@

  <h2>ERROR MESSAGES</h2>

 -<dl>
 -<dt>DBMI-DBF driver error: SQL parser error: syntax error,
 -unexpected DESC, expecting NAME processing 'DESC'</dt>
 -<dd>indicates that a column name corresponds to a reserved SQL word
 (here: 'DESC').
 +<h3>SQL synthax errors</h3>
 +
 +Depending on the SQL driver, you can have errors such as:
 +
 +<div class="code"><pre>
 +DBMI-SQLite driver error:
 +Error in sqlite3_prepare():
 +near "ORDER": syntax error
 +</pre/</div>
 +
 +Or:
 +
 +<div class="code"><pre>
 +DBMI-DBF driver error:
 +SQL parser error:
 +syntax error, unexpected DESC, expecting NAME processing 'DESC
 +</pre/</div>
 +
 +This indicates that a column name in the input dataset corresponds to a
 reserved SQL word (here: 'ORDER' and 'DESC' respectively).
  A different column name should be used. The <b>columns</b> parameter can
 be used
 -to assign different column names on the fly.</dd>
 -<dt>Projection of dataset does not appear to match the current
 location.</dt>
 -<dd>You need to create a location whose projection matches the data
 +to assign different column names on the fly.
 +
 +See a list of SQL reserved words for SQLite (the default driver) <a
 href='https://www.sqlite.org/lang_keywords.html'>here</a>.
 +
 +<h3>Projection errors</h3>
 +
 +<div class="code"><pre>
 +Projection of dataset does not appear to match the current location.
 +</pre/</div>
 +
 +You need to create a location whose projection matches the data
  you wish to import. Try using <b>location</b> parameter to create a
  new location based upon the projection information in the file. If
  desired, you can then re-project it to another location
 -with <em><a href="v.proj.html">v.proj</a></em>.</dd>
 -</dl>
 +with <em><a href="v.proj.html">v.proj</a></em>.

  <h2>REFERENCES</h2>


 }}}

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3563#comment:2>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list