OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
827 stars 301 forks source link

[Bug] query fails with shapefile linked with v.external #1164

Open petrasovaa opened 3 years ago

petrasovaa commented 3 years ago

Describe the bug

  1. Download US county boundaries
  2. Link with v.external
  3. Query with v.what:
ERROR 1: SQL Expression Parsing Error: syntax error, unexpected '='. Occurred around :
select * from us_county where  = 1832
                               ^
DBMI-OGR driver error:
Unable to select: 
select * from us_county where  = 1832

DBMI-OGR driver error:
Unable to select: 
select * from us_county where  = 1832

GRASS_INFO_ERROR(2729,1): Cannot open select cursor
GRASS_INFO_END(2729,1)

System description (please complete the following information):

Linux, master branch GDAL 3.0.4, released 2020/01/28

Additional context Apparently the geometry is not linked correctly to the attributes. Using v.in.ogr works. When I use ogr2ogr to convert the shapefile to gpkg first and then link, it works, it is somehow related to missing FID column, but I am not sure if it's specific to particular shapefile or shapefile format.

agiudiceandrea commented 2 years ago

The underlying v.external issue seems related to https://trac.osgeo.org/grass/ticket/981 and https://github.com/qgis/QGIS/issues/25978.