go-spatial / tegola

Tegola is a Mapbox Vector Tile server written in Go
http://tegola.io/
MIT License
1.25k stars 192 forks source link

Column name error when filtering on parameters #962

Open elpum4 opened 7 months ago

elpum4 commented 7 months ago

When I use a parameter to filter columns dynamically, the query executes correctly, and the database returns what I expected.

SELECT ST_AsBinary(geometry) AS geometry, id, collection_id, $1
            FROM table_features WHERE geometry && ST_MakeEnvelope(-63.7,-31.61,-63.72,-31.57,4326) 
AND collection_id = $2 with args [elevation my_uuid_collection_id]

My params config:

[[maps.params]]              
      name = "param"         
      token = "!param!"             
      type = "string"              
      sql = ",?"            
[[providers.layers]]
      name = "table_features"  
      geometry_fieldname = "geometry"  
      geometry_type="GeometryCollection"
      id_fieldname = "id"
      sql = """SELECT ST_AsBinary(geometry) AS geometry, id,  collection_id !param!
            FROM table_features WHERE geometry && !BBOX! !COL!"""

When I used a parameter (for example !param!) in the query selct in the response I got something similar to this:

?column?:"elevation"

However, when I detail the column directly, the select is executed in the same way but I correctly obtain something similar to this:

 [[providers.layers]]
      name = "table_features"  
      geometry_fieldname = "geometry"  
      geometry_type="GeometryCollection"
      id_fieldname = "id"
      sql = """SELECT ST_AsBinary(geometry) AS geometry, id,  collection_id, elevation
            FROM table_features WHERE geometry && !BBOX! !COL!"""

elevation: value