[GRASS-dev] [GRASS GIS] #400: Bogous SQL error message handling in db_execute_immediate

#400: Bogous SQL error message handling in db_execute_immediate
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.0
Component: Database | Version: svn-develbranch6
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
I was trying to import shapefile with v.in.ogr and it failed while trying
to create database. Only problem - there was no meaningfull error message
displayed. Using same SQL expression with db.execute also failed to
produce readable error message. After subsequent runs I once got some
wired character as error message most likely coming from bogous printf
statement argument. Still I was not able to identify origin of that error
message to check printf arguments.[[BR]]
Revision: 34900 make distclean && make
{{{
$ echo "create table gps_pents_osl (cat integer, SHAPEID integer, ELE
double precision, NAME varchar ( 80 ), DESC varchar ( 80 ), AUGST double
precision)" | db.execute
DBMI-DBF driver error:
SQL parser error: �۷
in statement:
create table gps_pents_osl (cat integer, SHAPEID integer, ELE double
precision, NAME varchar ( 80 ), DESC varchar ( 80 ), AUGST double
precision)

Error in db_execute_immediate()
}}}

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

#400: Bogus SQL error message handling in db_execute_immediate
--------------------------+-------------------------------------------------
  Reporter: marisn | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: critical | Milestone: 6.4.0
Component: Database | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by neteler):

  * summary: Bogous SQL error message handling in db_execute_immediate =>
              Bogus SQL error message handling in
              db_execute_immediate

Comment:

AFAIK "DESC" is a reserved SQL word which cannot be a column name.

See "ERROR MESSAGES" in the v.in.ogr manual. Apparently the vector modules
catch the error while the db.* modules don't.

Markus

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

#400: Bogus SQL error message handling in db_execute_immediate
--------------------------+-------------------------------------------------
  Reporter: marisn | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: critical | Milestone: 6.4.0
Component: Database | Version: svn-develbranch6
Resolution: | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Comment (by hamish):

the "SQL parser error: �۷" indicates e.g. %s of an uninitialized variable.

Hamish

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

#400: Bogus SQL error message handling in db_execute_immediate
--------------------------+-------------------------------------------------
  Reporter: marisn | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: critical | Milestone: 6.4.0
Component: Database | Version: svn-develbranch6
Resolution: fixed | Keywords:
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by marisn):

  * status: new => closed
  * resolution: => fixed

Comment:

Error message was used after freeing it. Fixed in r36326.

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